View Full Version : cannot get value from chained selectbox

06-26-2010, 09:15 PM
i am using chained selectbox in http://www.dynamicdrive.com/dynamicindex16/chainedselects/index.htm



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

<form name="listmenu0" action="x2.php" method="REQUEST">
<table align="center">
<td><select name="firstlevel"></select></td>
<td><select name="secondlevel"></select></td>
<td><select name="thirdlevel"></select></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">



foreach($_REQUEST as $a=>$b){
echo $a." - ".$b."<br/>";


i can get just last selectbox value but i wanna get three selectbox value

06-26-2010, 10:22 PM
Can you post a link to your page? We need to see what is being generated by the chained select script.

06-27-2010, 06:15 AM
Aerospace's request first, but also... request is not a valid method type, it should be post or get (your form element). Request is a PHP super variable that lets you access GET and POST with a single call, but shouldn't be used. If you're using post, use _POST, if you're using get, use _GET. If you use _REQUEST, someone can easily trick your system by putting in a variable into the url as a get variable and screw with your program. The fact that you're using an invalid method type might be screwing with everything.

06-27-2010, 10:24 AM
my codes is in attachment

Phil Jackson
06-27-2010, 10:49 AM
Have you no options in the select?

06-28-2010, 07:01 AM
Read what the functions actually do.


The third parameter of addOption and addList is the value of the option you are adding. You set these to "" so there will be no value which is why you aren't getting them in php.