Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
|
I like the switch statement in those cases. Much more readable than a if/else series.
PHP Code:
switch($gender){ case 'male': $gender='m'; break; case 'female': $gender='f'; break; case 'wether': $gender='w'; break; }
But you should rather use the "value" of the option rather than it's displayed value
HTML Code:
<select name'sel'>
<option value='m'>Male</option>
<option value='f'>female</option>
<option value='w'>Wteher</option>
</select>
and you will get back directly 'm','f', or 'w' without needing to check for the text returned.
__________________
Only a biker knows why a dog sticks his head out the window.
Last edited by tripy; 06-20-2010 at 05:44 PM..
|