Hello there,
I want to pass multiple values selected in a select box(HTML) to another php page.I tried doing in several ways but of no use.Can anybody please help me with this.
The code i used is in page 1 is:
[CODE=html]
<td align="left">
<select multiple name='srtestrun[]' style='width:30 0px;' size='10' >
<?php
if($srproject != 0 && $srproject > 0)
{ $sql = "SELECT TR.TEST_RUNID, TR.TEST_RUN_NAM E
FROM TEST_RUN TR, PROJECT_RUN PR
WHERE TR.TEST_RUNID = PR.TEST_RUNID
AND PR.PROJECTID = ".$srprojec t."
ORDER BY TR.TEST_RUN_NAM E";
$smc->query($sql) or die("<h4>Error in <br><br>".$sql. "</h4>");
$TR=$smc->result;
for($i=0; $i < sizeof($TR); $i++)
{ echo "<option value=\"".$TR[$i][0]."\">".$TR[$i][1]."</option>";
}
}
?>
</select>
</td>
[/CODE]
The code in page 2 to retrieve these values is:
[CODE=php]
$srtestrun = $_POST['srtestrun'];
for ($i = 0; $i < sizeof($srtestr un); $i++) {
echo $srtestrun[$i];
}
[/CODE]
But i am not able to get anything.If i am trying without using "$_POST" i am able to retrieve the last value i selected in the select box.
Thanks in Advance,
Shara.
I want to pass multiple values selected in a select box(HTML) to another php page.I tried doing in several ways but of no use.Can anybody please help me with this.
The code i used is in page 1 is:
[CODE=html]
<td align="left">
<select multiple name='srtestrun[]' style='width:30 0px;' size='10' >
<?php
if($srproject != 0 && $srproject > 0)
{ $sql = "SELECT TR.TEST_RUNID, TR.TEST_RUN_NAM E
FROM TEST_RUN TR, PROJECT_RUN PR
WHERE TR.TEST_RUNID = PR.TEST_RUNID
AND PR.PROJECTID = ".$srprojec t."
ORDER BY TR.TEST_RUN_NAM E";
$smc->query($sql) or die("<h4>Error in <br><br>".$sql. "</h4>");
$TR=$smc->result;
for($i=0; $i < sizeof($TR); $i++)
{ echo "<option value=\"".$TR[$i][0]."\">".$TR[$i][1]."</option>";
}
}
?>
</select>
</td>
[/CODE]
The code in page 2 to retrieve these values is:
[CODE=php]
$srtestrun = $_POST['srtestrun'];
for ($i = 0; $i < sizeof($srtestr un); $i++) {
echo $srtestrun[$i];
}
[/CODE]
But i am not able to get anything.If i am trying without using "$_POST" i am able to retrieve the last value i selected in the select box.
Thanks in Advance,
Shara.
Comment