...

View Full Version : cannot get value from chained selectbox



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


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="REQUEST">
<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($_REQUEST as $a=>$b){
echo $a." - ".$b."<br/>";
}

?>

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

_Aerospace_Eng_
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.

Keleth
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.

zodehala
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?

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

http://www.dynamicdrive.com/dynamicindex1/chainedmenu/chainedmenu.html

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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum