I use the following code snippet to build a drop down menu with the
results of a query. How can I set the initial value of this input based
on the result of another query?
What I am trying to do is update records in the data base. The field
WkEndDate is pulled along with the rest of the record and the drop down
menu is built from a table of valid WkEndDate values.
echo ("Weekend Date: <select name='WkEndDate '/> ");
while ($row = mysql_fetch_arr ay($result2)) {
echo ("<option value='" . $row["Date"] . "'>" .
date('F j, Y', strtotime($row["Date"])));
}
echo ("</select><br>");
The initial value in the form is always the first value from result2 and
I would like it to be the value from result1 (not shown).
Thanks,
Mike
results of a query. How can I set the initial value of this input based
on the result of another query?
What I am trying to do is update records in the data base. The field
WkEndDate is pulled along with the rest of the record and the drop down
menu is built from a table of valid WkEndDate values.
echo ("Weekend Date: <select name='WkEndDate '/> ");
while ($row = mysql_fetch_arr ay($result2)) {
echo ("<option value='" . $row["Date"] . "'>" .
date('F j, Y', strtotime($row["Date"])));
}
echo ("</select><br>");
The initial value in the form is always the first value from result2 and
I would like it to be the value from result1 (not shown).
Thanks,
Mike
Comment