I've read other questions on here that dealt with what I am looking for. But it still did not help me.
I want to have multiple values in an option of the select tag of a form that will be posting the information onto a different file that is viewable to the visitor by iframe. Example of what I am trying to do:
The following is on the file: Form.php
<form action"blank.php" method="post" target="box">
<option name="g1" value="Value 1, Value 2"> Text </option>
<option name="g1" value="Value 1, Value 2"> Text Blah </option>
<input type="submit" />
<iframe src="blank.php" name="box"></iframe>
[ Value 1 ] [ Value 2 ]
[Hola] means [Hello].
<option name="g1" value="Hola, Hello">Hola - Hello</option>
First of all, you don't need a
name attribute on each of your
<option> elements. Just the
Second of all, I think all you need is the handy dandy
explode function. You'll get the value like this...
$values = $_POST['g1'];
...and then split them into an array like this...
$values = explode(', ', $values);
...and finally just access the values like so:
$value1 = $values; $value2 = $values;