In the following code, once a horse is selected and submit is clicked, the whole page reloads and information regarding the 1st horse in the select menu is shown. How do I make the menu retain the horse that is selected after submit is clicked?
<?php
$hourqry=mysql_query("SELECT * FROM horse");
echo '<td>Horse:<select name=hhours>';
while ($hrow = @mysql_fetch_assoc($hourqry))
{
echo "<option value=\"$hrow[reg_num]\">$hrow[reg_name]</option>\n";
}
echo ("<input type=Submit name=rsubmit value=Show></form>");
if ($rsubmit) {
$shname=$_SESSION['username'];
$rides=mysql_query("SELECT * FROM ridehours WHERE rider='$shname' AND horse='$hhours'");
$hournum=mysql_numrows($rides);
$hr=0;
while ($hr < $hournum) {
$date=mysql_result($rides,$hr,"date");
$rider=mysql_result($rides,$hr,"rider");
$ridelocation=mysql_result($rides,$hr,"ridelocation");
$hours=mysql_result($rides,$hr,"hours");
echo ("$date<br>$ridelocation | $hours<br>");
++$hr;
}
} else {
echo ("Please select a horse to view hours you've ridden.");
}
?>