Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- Multiple Form Values in One Field To Submit To Scripts?


pixeltierra - 2:52 pm on Sep 11, 2006 (gmt 0)


Since only the 'value' is sent to the script that's all you get, so you have to work with it. You have at least two options:

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
name="widget['type']" value="green"
name="widget['price']" value="50"
This way you can handle the data as one 'variable' (widget) in the script.

I recommend option one.


Thread source:: http://www.webmasterworld.com/php/3078852.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com