Eggzorcist Posted August 25, 2009 Share Posted August 25, 2009 Is it possible in php to create a dropdown menu with 2 values. so if - Item 1 - has value "hello" and value id "5" and value_cost "50$" how can I make it so there is 3 values from that one item from a dropdown menu? any ideas? thanks Quote Link to comment https://forums.phpfreaks.com/topic/171840-creating-a-dropdown-menu-with-3-values-each-item/ Share on other sites More sharing options...
AviNahum Posted August 25, 2009 Share Posted August 25, 2009 try to explain better please... Quote Link to comment https://forums.phpfreaks.com/topic/171840-creating-a-dropdown-menu-with-3-values-each-item/#findComment-906084 Share on other sites More sharing options...
mikesta707 Posted August 25, 2009 Share Posted August 25, 2009 I don't think there is a way to create more than one value attribute for a html form, and pass that into PHP. You can create your own attributes I believe, but I think Javascript is the only thing that can do stuff with them. What you can do is create a value that is something like value="hello:5:50" and when you get the value in PHP, do an explode() on it (in my case, the delimiter would be ":", which will turn it into an array of each of the values. Beyond that I don't see a way for you to create different values for the same selection Quote Link to comment https://forums.phpfreaks.com/topic/171840-creating-a-dropdown-menu-with-3-values-each-item/#findComment-906091 Share on other sites More sharing options...
Eggzorcist Posted August 25, 2009 Author Share Posted August 25, 2009 well ill be getting the info for the dropdown menu's from the database, and the database will have the values of id, name, price. I want it so if you select item_1 I will be able to put a sql_query to attach id, name and price, to the user using the program. Quote Link to comment https://forums.phpfreaks.com/topic/171840-creating-a-dropdown-menu-with-3-values-each-item/#findComment-906096 Share on other sites More sharing options...
Eggzorcist Posted August 25, 2009 Author Share Posted August 25, 2009 I'll use the explode() method... thanks Quote Link to comment https://forums.phpfreaks.com/topic/171840-creating-a-dropdown-menu-with-3-values-each-item/#findComment-906117 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.