html form select list "selected"

From: Date: Wed, 20 Mar 2002 21:20:45 +0000
Subject: html form select list "selected"
Groups: php.general 
Request: Send a blank email to php-general+get-89409@lists.php.net to get a copy of this message
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!

« previous php.general (#89409) next »