zohab Posted November 17, 2007 Share Posted November 17, 2007 hi all i have used following code in my project.There are 2 combo box first one dependent on other now the problem is i want to perform operation on second combo box i am not able to get value from second combo box. e.g in select box we have values in <option value=""></option> i need option value or other to perform operation dynamicdropdown.php <? include("mysqlconnect.php"); $db='universus'; mysql_select_db($db); ?> <html> <head> <script src="selectcustomer.js"></script> </head> <body> <form> Select a Project Name: <? $sql_sel="select * from prjmaster"; $res=mysql_query($sql_sel); ?> <select name="prjname" onchange="showCustomer(this.value)"> <? while($row1=mysql_fetch_array($res)){ echo "<option " .$select. " value='".$row1['prjID']."'>".$row1['prjName']."</option>"; } echo "</select>"; ?> </form> <p> <div id="txtHint">Task info will be listed here.</div> </p> </body> </html> <script language="javascript"> var xmlHttp function showCustomer(str) { xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) { alert ("Your browser does not support AJAX!"); return; } var url="gettask.php"; url=url+"?q="+str; url=url+"&sid="+Math.random(); xmlHttp.onreadystatechange=stateChanged; xmlHttp.open("GET",url,true); xmlHttp.send(null); } function stateChanged() { if (xmlHttp.readyState==4) { document.getElementById("txtHint").innerHTML=xmlHttp.responseText; //alert(document.getElementById("txtHint").innerHTML); } } function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } </script> gettask.php <? include("mysqlconnect.php"); $db='universus'; mysql_select_db($db); $id=$_REQUEST['q']; //echo "$id"; $sql_task="select * from prjtaskdetail where prjID='".$id."'"; $query2=mysql_query($sql_task); echo "<select name='prjtask'>"; while($row2 = mysql_fetch_array($query2)){ echo "<option value='".$row2['taskID']."'>".$row2['Description']."</option>"; } echo "</select>"; ?> need help. thanks in advance Quote Link to comment Share on other sites More sharing options...
Lijoyx Posted November 19, 2007 Share Posted November 19, 2007 Ok tell me what is ur problem. just remember this people usually don't have the patients to read all your code if its too big. i think i can help u if u tell me what actually is ur problem Quote Link to comment Share on other sites More sharing options...
zohab Posted November 20, 2007 Author Share Posted November 20, 2007 if i do $_POST['firstboxname']; i am getting first combo box value.(option values in combo box) but if i do $_POST['secondboxname'] with second combo box i am not getting values. Quote Link to comment Share on other sites More sharing options...
zohab Posted November 21, 2007 Author Share Posted November 21, 2007 i have 2 combo box one dependent on other using ajax. i want one more combo box or textfield dependent on second combox and so on more textfield/combo box/radio/ etc in ajax dependent on each other Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.