option selected

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm using the contents of a table to print an option list in another form to
allow me to cross reference the tables in my data.

<? $result = mysql_query("SELECT * FROM category",$db);
printf("<select name=\"catcode\">\n");
while ($myrow = mysql_fetch_array($result)) {
printf("<option value=\"%s\">%s</option>\n", $myrow["catcode"],
$myrow["title"]); 
}
printf("</select>\n");
?>

Once i have selected from the drop box the variable is submitted back to my
table and saved. 

When re-edit the data - the record already has a value for catcode which i
want to reflect within the drop box - in html it would be the addition of
selected="selected" within the <option>.

Are there any recommended methods of doing this?
-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email       >> mikek@brightstorm.co.uk
Web         >> http://www.brightstorm.co.uk
Tel         >> 0117 9426653 (office)
               07939 252144 (mobile)

Snailmail   >> Unit 8, 14 King Square,
               Bristol BS2 8JJ


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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux