Re: option selected

From: Date: Mon, 25 Nov 2002 12:44:39 +0000
Subject: Re: option selected
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-23649@lists.php.net to get a copy of this message
mike karthauser wrote:
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 . Are there any recommended methods of doing this?
I'd change the following:
printf("<option value=\"%s\">%s</option>\n", $myrow["catcode"], $myrow["title"]);
into this: $l=$myrow['catcode']; ?><option value="<?=$l;?>"<?=($catcode==$l)?' selected="selected"':"";?>><?=$myrow['cattitle'];?></option><? -- Kae Verens _______\_ webworks.ie work: www.webworks.ie _____\\__ webhosts play: www.contactjuggling.org ___\\\___ design kae: kverens.contactjuggling.org _\\\\____ code

« previous php.db (#23649) next »