Vojta Kudlacek Vojta Kudlacek - 9 months ago 30
PHP Question

Need 2 values for one select option

Basically I need to make "Select option" from input:

<input type="text" name="value[min]" value="0">
<input type="text" name="value[max]" value="100">

to something like that:

<select name="value[min|max]">
<option value="0|100">0-100 value</option>


As you are taking a single value from the option, no need to make things complex by trying to get the minand max value this way.

Instead just get the value on server side and format it for your need.

I would have done it this way:

<select name="value">
  <option value="0|100">0-100 value</option>

And on server side:

$value = explode('|', $_POST['value']);
$min = $value[0];
$max = $value[1];