function addgroup(){ echo '<h5><center>Додати группу</center></h5>'; $addcategory = ' <form method="POST"> <div class="row"><div class="col s12"> <p>Примітки <input type="text" name="text"> <h5><center>Розклад<i class="material-icons">access_time</i></center></h5> <div class="input-field col s6"> <center><h5>Понеділок</h5></center> <input type="text" name="t1"><p> </div> <div class="input-field col s6"> <center><h5>Вівторок</h5></center> <input type="text" name="t2"><p> </div> <div class="input-field col s6"> <center><h5>Середа</h5></center> <input type="text" name="t3"><p> </div> <div class="input-field col s6"> <center><h5>Четверг</h5></center> <input type="text" name="t4"><p> </div> <div class="input-field col s6"> <center><h5>П`ятниця</h5></center> <input type="text" name="t5"><p> </div> <div class="input-field col s6"> <center><h5>Субота</h5></center> <input type="text" name="t6"><p> </div> '.select_add_group().' <p><center><a class="waves-effect red btn"><input type="submit" name="ok"></a></center></div></div> </form>'; echo $addcategory; $login=$_SESSION['login']; $text=$_REQUEST['text']; $t1=$_REQUEST['t1']; $t2=$_REQUEST['t2']; $t3=$_REQUEST['t3']; $t4=$_REQUEST['t4']; $t5=$_REQUEST['t5']; $t6=$_REQUEST['t6']; $ok=$_REQUEST['ok']; $select = $_REQUEST['select_category']; if ($ok==true){ $add = mysql_query ("INSERT INTO groups (text, login, t1, t2, t3, t4, t5, t6, category, teacher) VALUES ('$text', '$login', '$t1', '$t2', '$t3', '$t4', '$t5', '$t6', '$select', '$teacher')"); if ($add==true){ echo "Група додана"; echo "<HTML><HEAD> <META HTTP-EQUIV='Refresh' CONTENT='0; URL=admin.php?action=group'> </HEAD>"; } else echo "Ошибка"; } } function select_add_group(){ $res=mysql_query("SELECT id, name FROM disc"); echo '<select class="browser-default" name="select_category">'; for ($x=0; $x<count($row=mysql_fetch_array($res)); $x++ ) { echo '<option value="'.$row['id'].'">'.$row['name'].'</option>'; } echo '</select></div>'; }
Comes an empty value in the database. I would be grateful for any tips.