RE: [PHP] to select or not to select...

From: Date: Tue, 31 Oct 2000 05:17:33 +0000
Subject: RE: [PHP] to select or not to select...
Groups: php.general 
Request: Send a blank email to php-general+get-22854@lists.php.net to get a copy of this message
I wrote something like this long ago. It is tough to find it now in my libraries but the idea was : go to the source of where these fields are coming from then make an array and loop them checking for what is selected assigning it's properties. It is all in a funcion($source) or you can make it be a class if you wish. I don't think it was a pain to write. Cheers!, Maxim Maletsky -----Original Message----- From: Joseph H Blythe [mailto:joe.blythe@binarylogic.com.au] Sent: Tuesday, October 31, 2000 1:16 PM To: PHP-General Subject: [PHP] to select or not to select... Hey all, Can an anyone suggest a better way to do the the following? <select name="foo"> <?php if ( $sel == "bar" ) { ?> <option value="bar" selected>bar</option> <?php } else { ?> <option value="bar">bar</option> <?php } ?> As you can see I am choosing what option is selected in a list/menu the above example works fine until you have lots of options then it is a nightmare, I have tried a few things to no avail does anyone know a cleaner/simpler way of doing this? Any suggestions would be great, Regards, Joseph -- BoldFX / Binary Logic 750 Port Road Beverley 5009 Ph: (08) 8244 1800 Fax: (08) 8244 1811 mailto: joseph.blythe@binarylogic.com.au -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#22854) next »