Log in

View Full Version : geting value from chained selectbox



zodehala
06-27-2010, 06:01 PM
i am using chained select box in http://www.dynamicdrive.com/dynamicindex16/chainedselects/index.htm

i wanna send all three selectbox value to x2.php. But i can send just last one why ?

(my full codes is in attachment. )

sample.html

<html>

<head>
<title>Chained Selects</title>
<script language="javascript" src="chainedmenu.js"></script>
<script language="javascript" src="config.js"></script>
</head>
<body onLoad="initListGroup('chainedmenu', document.listmenu0.firstlevel, document.listmenu0.secondlevel, document.listmenu0.thirdlevel, 'savestate')">

<form name="listmenu0" action="x2.php" method="POST">
<table align="center">
<tr>
<td><select name="firstlevel"></select></td>
<td><select name="secondlevel"></select></td>
<td><select name="thirdlevel"></select></td>
<td>
<input type="button" value="Go" onClick="goListGroup(document.listmenu0.firstlevel, document.listmenu0.secondlevel, document.listmenu0.thirdlevel)">
<input type="button" value="Reset" onClick="resetListGroup('chainedmenu')">
<input name="" type="submit" value="Submit">
</td>
</tr>
</table>
</form>
</body>

</html>

x2.php



<?php
foreach($_POST as $a=>$b){
echo $a." - ".$b."<br/>";
}

?>