-
1. Re: Radio Buttons w/ Multiple Values on a PHP Form
SnakEyez02 Feb 21, 2010 7:58 PM (in response to pbsum83)Yes you can do this. If I were you I would eliminate the space in the value just to eliminate confusion. Then when you process the variable use the Explode function ( http://php.net/manual/en/function.explode.php ) to separate the values in your string. So if you eliminate the space your code would look like:
$_POST['option'] = $option;
$option = explode ("-",$option);
print $option[0]; //This would print the material
print $option[1]; //This would print the price
The only trick is your first two options don't have a color. So your arrays would be different. To offset this I would recommend that you use the same format for all options and make some sort of null value if nothing will be added for one value in the array, ie: color.
-
2. Re: Radio Buttons w/ Multiple Values on a PHP Form
pbsum83 Feb 21, 2010 10:04 PM (in response to SnakEyez02)Thank you very much! That definitely helps a lot.
I also have one more issue pertaining to multiple values with radio buttons. If i have a setup like below, how would I retrieve not only the category (Senor, Adult, or Youth), but find out whether they chose 'Male' or 'Female' AND find out the price (for adding to the total)? Is there a way I can somehow attach hidden values to each radio button for later retrieval?
Seniors $30:
Male (radio button)
Female (radio button)
Adult $50:
Male (radio button)
Female (radio button
Youth $40:
Male (radio button)
Female (radio button)
Thanks!
Paul
-
3. Re: Radio Buttons w/ Multiple Values on a PHP Form
pbsum83 Feb 22, 2010 10:41 AM (in response to pbsum83)Anyone? Sorry for bumping. Just didn't want it to get lost in the shuffle. Hoping to sort it out today if possible. Thanks!


