Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can an Option in a Select tag carry multiple values?

I got a select tag with some options in a HTML form:
(the data will be collected and processed using PHP)

Testing:

<select name="Testing">  
  <option value="1"> One  
  <option value="2"> Two  
  <option value="3"> Three
</select>

Is it possible for an option to carry multiple values like when a user selects "One", then a few other values related to this option will be written to the Database.

How should I design the select Tag so that each of the options can carry one than one value like this:

<select name="Testing">  
  <option value="1" value="2010"> One  
  <option value="2" value="2122"> Two  
  <option value="3" value="0"> Three
</select>
like image 312
user327712 Avatar asked Oct 08 '22 19:10

user327712


1 Answers

One way to do this, first one an array, 2nd an object:

    <select name="">
        <option value='{"num_sequence":[0,1,2,3]}'>Option one</option>
        <option value='{"foo":"bar","one":"two"}'>Option two</option>
    </select>
like image 180
Robusto Avatar answered Oct 19 '22 05:10

Robusto