Here are my POST variables:
$Start_HOUR,$Start_MIN,$Start_AMPM
$End_HOUR,$End_MIN,$End_AMPM
Since the form fields are identical for start and end times (except for the variable names), I don't want to have to list them twice, but I can't figure out how to get around it. You'll also see a few other inefficiencies around the selected MIN and AMPM.
Code: Select all
/* Use drop down lists to select the start and end times */
echo
"Start Time:<br>\n<td>";
/* Drop down list for the hour */
for ($n=1; $n<=12; $n++)
{
echo "<option value=$n";
if ($n == '$Start_HOUR')
{
echo " selected";
}
echo ">$n\n";
}
echo "</SELECT>\n";
/* Drop down list for the minute */
echo "<select name= '$Start_MIN'>\n";
echo "<option value='00'>00\n
<option value='15'";
if ('$Start_MIN' == 15)
{
echo " selected";
}
echo ">15\n
<option value='30'";
if ('$Start_MIN' == 30)
{
echo " selected";
}
echo ">30\n
<option value='45'";
if ('$Start_MIN' == 45)
{
echo " selected";
}
echo ">45\n
</SELECT>\n";
/* Drop down list for AM/PM */
echo "<select name= $value.'_AMPM'>\n";
echo "<option value='AM'";
if ('$Start_AMPM' == 'AM')
{
echo " selected";
}
echo ">AM\n
<option value='PM'";
if ('$Start_AMPM' == 'AM')
{
echo " selected";
}
echo ">PM\n
</SELECT><p>\n";
}I know there's a better way. Any help would be appreciated. Ruth