|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
<form name=form1 action=process.php>
<SELECT NAME="toppings" MULTIPLE SIZE=5> <OPTION VALUE="mushrooms">mushrooms <OPTION VALUE="greenpeppers">green peppers <OPTION VALUE="onions">onions <OPTION VALUE="tomatoes">tomatoes <OPTION VALUE="olives">olives </SELECT> </form> when i select 2 or more items in the select object toppings, there is ONLY ONE value in the form1.toppings.value ie :- olives even if i select both onions and olives. how do i pass all the selected values to process.php ? Thanks. |
|
#2
|
|||
|
|||
|
What's happening is that "olives" is overwriting the value "onions" in your variable "toppings" because "toppings" can only contain one value at a time.
The solution is to use an array. Change your SELECT statement to look like this: <SELECT NAME="toppings[]" MULTIPLE SIZE=5> See PHP FAQ Section 5.9 - http://www.php.net/FAQ.php3#5 |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > PHP Development > how to pass 2 or more values in the select object ? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|