i am fetching categories and their sub-categories from the database.and filtering the sub-categories after selecting the category bu using dropdown.after selecting when i submit the form, the value of the sub-category is 0, form does not posting the selected value. \[code\]<?php if(isset($_POST) && $_POST['submit'] == "Add") { extract($_POST); $scat_id = $regions['scat_id']; echo $sqlpa = "INSERT INTO products(mcat_id, scat_id)VALUES('$mcat_id', '$scat_id')"; $resultpa = mysql_query($sqlpa); } ?><script type="text/javascript"> function getregions(mcat_id) { if (mcat_id=="") { document.getElementById("region").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("region").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","getregions.php?mcat_id="+mcat_id,true); xmlhttp.send(); } </script> <form action="" method="post" name="p_add" id="p_add"> <table> \[/code\] \[code\] <tr> <td>Select Category</td> <td><select name="mcat_id" id="mcat_id" onchange="getregions(this.value);"> <option value="">Select</option> <?php if(!empty($resultm)) { foreach($resultm as $rm) { ?> <option value="http://stackoverflow.com/questions/12777641/<?php echo $rm['mcat_id']; ?>"><?php echo $rm['mcat_name'];?> (<?php echo $rm['mcat_id']; ?>)</option> <?php } } ?> </select> </td> </tr> <tr> <td>Select Sub-Category</td> <td> <div id="region"> <select name="scat_id" id="scat_id"> <option value="">Please Select</option> </select> </div> </td> </tr> <tr> <td> </td> <td><input type="submit" name="submit" value="http://stackoverflow.com/questions/12777641/Add" /></td> </tr> </table> </form>\[/code\]-->this page is getregions.php where filtering is done:\[code\]<?php include "../conn.php"; $mcat_id=$_GET['mcat_id']; $sql = "SELECT * FROM sub_category WHERE mcat_id = '".$mcat_id."'"; $res = mysql_query($sql); while($row = mysql_fetch_array($res)) { $rec[] = $row ; }?><select name="scat_id" id="scat_id"> <option value="">Please Select</option><?php foreach($rec as $regions) {?> <option value="http://stackoverflow.com/questions/12777641/<?php echo $regions['scat_id'];?>"><?php echo $regions['scat_name'];?></option><?php }?></select>\[/code\]