RE: [PHP] New way to make select boxes auto select

From: Date: Thu, 25 Jul 2002 19:04:47 +0000
Subject: RE: [PHP] New way to make select boxes auto select
Groups: php.general 
Request: Send a blank email to php-general+get-109579@lists.php.net to get a copy of this message
> From: Nathan Cook [mailto:ncook@pcsedu.com] > Sent: Thursday, July 25, 2002 2:52 PM > Subject: Re: [PHP] New way to make select boxes auto select > How are you able to quickly and painlessly determine which > key gets the > selected value, from form submission data, when building the > initial array? Via the selected name, say, $POST['location']. I usually use the db code table method and something like: echo setupSelect($db,"locations","LocName","LocName",$_POST['location']); If you were using hard coded values like Active, Inactive,etc you can just do a: $status = array('Active','Inactive'); $status[$_POST['status']] = 'selected; echo buildSelect($status); It doesn't handle multi selects and it's resulting arrays, but that should be too hard to do by checking if the selected value is an array & modify the comparison in that case.

« previous php.general (#109579) next »