Fwd: html form select list "selected"
| From: | ROBERT MCPEAK | Date: | Wed, 20 Mar 2002 21:23:31 +0000 |
| Subject: | Fwd: html form select list "selected" | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-89412@lists.php.net to get a copy of this message | ||
Whoops! Still won't work but that code should read:
echo "<form>";
echo "<select name=\"display\">";
echo "<option value=\"true\"";
if ($display==true){echo "selected";}
echo ">Display";
echo "<option value=\"false\"";
if ($display==false){echo "selected";}
echo "selected>Don't Display";
echo "</select>";
echo "</form>";
>>> ROBERT MCPEAK 03/20/02 04:20PM >>>
I'd like to determine the selected option in a select list based on a
passed variable. The code below won't work, but I can't figure out why.
Any guesses?
echo "<form>";
echo "<select name=\"display\">";
echo "<option value=\"true\"";
if ($display==false){echo "selected";}
echo ">Display";
echo "<option value=\"false\"";
if ($display==false){echo "selected";}
echo "selected>Don't Display";
echo "</select>";
echo "</form>";
Thanks!