<?php
echo '<div class="phdr"><b>Tezkor xikoya yozish</b></div>';
echo '<!-- Maksim -->';
if ( isset($HTTP_GET_VARS[Maksim]) || isset($HTTP_POST_VARS[Maksim]) )
{
$id = ( isset($HTTP_GET_VARS[Maksim]) ) ? intval($HTTP_GET_VARS[Maksim]) : intval($HTTP_POST_VARS[Maksim]);
}
else if ( isset($HTTP_GET_VARS['id']))
{
$id = intval($HTTP_GET_VARS['id']);
}
else
{
$id = '';
}
$name = isset($_POST['name']) ? mb_substr(functions::checkin($_POST['name']), 0, 100) : '';
$text = isset($_POST['text']) ? functions::checkin($_POST['text']) : '';
if($user_id) {
echo '<div class="menu"><form name="form" enctype="multipart/form-data" action="library/index.php?act=addnew&amp;" . Maksim ."=$id" method="post">
<p>Xikoya nomi <small>(max. 100)</small>:<br>
<input type="text" name="name" value="' . $name . '" /></p>
<p>Xikoyaga mos keluvchi bo\'limni tanlang:<br>';
echo '<select name="id">';
$req = mysql_query("SELECT * FROM `library_cats` WHERE `id` ORDER BY `name` DESC"); 
while ($category = mysql_fetch_assoc($req)) {
echo '<option value="'. $category['id'] .'">' . $category['name'] . '</option>';
}
echo '</select></p><p>Xikoya matni <small>(iltimos batafsilroq yozing)</small>:<br>
<textarea name="text" rows="' . $set_user['field_h'] . '" cols="20">' . $text . '</textarea></p>
<p><input type="checkbox" name="comments" value="1" checked="checked" /> Fikr bildirishga ruxsat berish</p>
<p><input type="submit" name="submit" value="Yozish" /></p></form></div>';
} else {
echo '<div class="menu">Xikoya yozish uchun <a href="registration.php">ro`yhatdan o`tishingiz</a> shart.</div>';
}
?>