<form action="a.php" method="post">
<select id="sel_1" name="sel[]" multiple>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<select id="sel_2" name="sel[]" multiple>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<input type="submit"/>
</form>
Now when i am trying to fecth the data like this
$offer = $_POST['sel'];
print_r($offer);
its displaying data like this:
Array
(
[0] => 1 // 1, 2 selected for sel_1
[1] => 2
[2] => 2 // 2, 3 selected for sel_2
[3] => 3
)
Shouldn't it come like this?
Array
(
[0] => Array(
[0] => 1
[2] => 2
)
[1] => Array(
[0] => 2
[2] => 3
)
)
I want to create string data like this(in the nxt a.php file):
for sel_1 data is created like "1, 2";
for sel_2 data is created like "2, 3";
How can i fetch the data in the above format.
I am trying this
for($i = 0; $i<count($offer) ; $i++)
{
for($j = 0; $j<count($offer[$i]); $j++)
{
$string = $tring. $offer[$i][$j];
}
}