Welcome to WebmasterWorld Guest from 188.8.131.52
Let's say I'm selling blue, red, and green widgets. I have a radio button that chooses which one you want to purchase. What I need to happen, is when the form posts to a PHP script, is to have a variable available for both the name of the product chosen, as well as the price of that product.
Kind of like: ( I know this won't work, but it illustrates my point)
<input type="radio" name="widgets" value1="Blue Widget" value2="$50">BLUE WIDGETS</input>
<input type="radio" name="widgets" value1="Green Widget" value2="$75">GREEN WIDGETS</input>
<input type="radio" name="widgets" value1="Red Widget" value2="$25">RED WIDGETS</input>
Any suggestions are greatly appreciated!
1) use one field
2) use two fields
Option 1 can easily be accomplished by making a value like this:
value="red widget-$50" and then using php explode() on the '-' to get your two values.
Option 2 can be accomplished by using an array
This way you can handle the data as one 'variable' (widget) in the script.
I recommend option one.