----- Original Message -----
From: "Denis L. Menezes" <[EMAIL PROTECTED]>
To: "PHP general list" <[EMAIL PROTECTED]>
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");
}



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to