On Wednesday, March 20, 2002, at 04:23 PM, ROBERT MCPEAK wrote:
> 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>"; First of all, this form doesn't have a method or action attribute -- so I'm not sure which script you intend to call with it, or what HTTP protocol you intend to pass the data with. But assuming it's the POST method and the action is PHP_SELF, and that you are using PHP 4.1.x or greater: // perform a test to see which should be selected if ($_POST['display'] == 'true') { $select_if_true = "selected=\"yes\""; $select_if_false = "selected=\"no\""; } elseif ($_POST['display'] == 'false') { $select_if_true = "selected=\"no\""; $select_if_false = "selected=\"yes\""; } // create the form, including the above-defined variables $form_html = " <form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\"> <select name=\"display\"> <option $select_if_true value=\"true\">Display</option> <option $select_if_false value=\"false\">Don't Display</option> </select> </form>"; // print the form print $form_html; HTH Erik ---- Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php