Either make the onchange event post the page to itself, and use logic to create another dropdown, or use ajax to dynamically populate the second dropdown.
Hi Jestep Nice idea, i also try that it works but thr was some problem, when am selects my 1st dropdown its display a second dropdown , but the value of 1st dropdown will goes to the default value.. I use the following code if u have any idea means feel free to share me.. <body> <table><tr><td> <form name="f" action="" method="POST"> Year : <select name="caryear" onchange='javascript:getmake(this.value);'> <option value="0">0</option> <option value="2012">2012</option> <option value="2011">2011</option> <option value="2010">2010</option> <option value="2009">2009</option> </select> <form> <?php echo $idvalue= $_GET['Value1']; //alert($idvalue); ?> <br> <script type='text/javascript'> function getmake(year) { var y=year; window.location.href = "done.php?Value1=" +y; //alert($var); } </script> <form name="ff" action="" method="POST"> <?php $caryear=$idvalue; $query="SELECT Distinct carmake FROM car where caryear= '$caryear'"; $result = mysql_query($query); echo '<br>Car MAKE<select name="selcarmake" onchange="javascript:getmodel(this.value);">'; while($nt=mysql_fetch_array($result)) { $name = $nt['carmake']; echo '<option value="' . $name . '" >' . $name . '</option>'; } echo '</select>'; ?> </script> </form> <script type='text/javascript'> function getmodel(model) { var m=model; window.location.href = "done.php?Value2=" +m; //alert($var); } </script> <?php //echo $mvalue= $_GET['Value2']; $mvalue= $_GET['Value2']; //alert($idvalue); ?> <form name="fff" action="" method="POST"> <?php $carmake=$mvalue; $query="SELECT Distinct carmodel FROM car where carmake= '$carmake'"; $result = mysql_query($query); echo '<br>Car Model<select name="selcarmodel" onchange="javascript:getmodel(this.value);">'; while($nt=mysql_fetch_array($result)) { $name = $nt['carmodel']; echo '<option value="' . $name . '" >' . $name . '</option>'; } echo '</select>'; ?> <input type="submit" name="submit" value="submit"> </form> <?php echo $msg; ?> </td> </tr> </table> </form> </body>