I want to use the select option to update the table. these are the code and when I try it, no data have been display to table..Help me pls....
these code are for select option.
<form method="POST">
<text class="sort"><span>Course:</span></text>
<select class="sel" name="select_course" id="select_course">
<?php
$query=mysqli_query($conn,"select DISTINCT Course from `tbl_student`");
while($row=mysqli_fetch_array($query)){
?>
<option><?php echo $row['Course'];?></option>
<?php
}
?>
</select>
<input class="btnsearch" type="button" name="submit" value="Search">
<input class="btn" type="button" name="btn_add" value="Add Student">
<input class="btn_import" type="button" name="import" value="Import File">
And these code are for displaying data to table.
<?php
echo '<table>
<tr>
<td>name</td>
<td>Id number</td>
<td>Course</td>
<td>School Year</td>
<td>Semester</td>
</tr>';
if(isset($_POST['submit']))
{
$result2 = mysqli_query($conn, "Select name,id_number,Course,school_year,semester from tbl_student where Course='".$_POST['select_course']."'");
while($row=mysqli_fetch_row($result2)){
echo '<tr>
<td>'.$row["name"].'</td>
<td>'.$row["id_number"].'</td>
<td>'.$row["Course"].'</td>
<td>'.$row["school_year"].'</td>
<td>'.$row["semester"].'</td>
</tr>';
}
echo '</table>';
}
?>
</form>
All i want is when I choose from the select option the table will be updated automatically.