My first php code gets the values from the table "mytable" which are January, February and March respectively. It works well, I could see Month,January,February and March inside the drop down list. My problem is within the second php code, when I click the search button, nothing happens. What I expected it to do was print out the value from the drop down list but sadly, I get nothing.
<select name="monthchoice">
<option value="">Month</option>;
<?php
$request="SELECT date FROM mytable WHERE username='qwe'";
$result=mysqli_query($con, $request);
while($fetch = mysqli_fetch_assoc($result))
{
echo '<option value="'.$fetch['date'].'">'.$fetch['date'].'</option>';
}
?>
</select>
<input type="submit" value="Search" name="submit"/>
<?php
if(isset($_POST["submit"]))
{
if(!empty($_POST['monthchoice']))
{
$monthchoice1=$_POST['monthchoice'];
echo "<br>";
echo $monthchoice1;
}
else
{
echo "<br>";
echo 'Please choose a month!';
}
}
?>