tags:

views:

42

answers:

2

If I have a combobBox with values red/white/blue and the users chooses blue then I want my form action php page to use the value 2, not `blue. I hope you see what I mean.

Is there any easy way to do that?

+5  A: 

You do this by constructing your form appropriately and supplying a value attribute:

<option value="2">blue</option>
deceze
+5  A: 
<form action='phpPage.php' name='bsForm' method='POST'>
<select name='TheColor' onSelect="bsForm.submit()">
   <option value='0'>red</option>
   <option value='1'>white</option>
   <option value='2'>blue</option>
</select>
</form>

If your form looks anything like that, then your phpPage should easily be able to get the value 2 from $_POST['TheColor']

Zane Edward Dockery
d'oh! My values were red/white/blue :-)
Mawg