Jump to content

Creating a dropdown menu with 3 values each item.


Eggzorcist

Recommended Posts

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

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.