Re: question on listbox.
| From: | Matt | Date: | Sat, 01 Feb 2003 12:25:23 +0000 |
| Subject: | Re: question on listbox. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-133867@lists.php.net to get a copy of this message | ||
----- Original Message -----
From: "Denis L. Menezes" <menezesd@singnet.com.sg>
To: "PHP general list" <php-general@lists.php.net>
Sent: Saturday, February 01, 2003 6:08 AM
Subject: [PHP] question on listbox.
Hello friends.
>I have a listbox which I populate from a query with the database. It is
>working fine. But additinally, I want the first item to be "Select
category". >Can someone please help me how to modify by below written code
to do > the above?
something like this would do it:
$valueToSelect = 'foo';
{
Print("<OPTION VALUE=\"{$Category[0]}\"
$selected = ($Category[0] == $valueToSelect) ? ' selected' : '';
Print($selected);
Print(">{$Category[0]}\n");
}