porta325 Posted March 12, 2008 Share Posted March 12, 2008 Hey guys, i have a small dependant menu but after the page reloads to populate the second listbox the first lisbox returns to original value.I need to keep that value after the form is submited.This is a code sample: <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script> function mySubmit() { // assign our form to object f var f = document.forms.myForm; f.submit(); } </script> </head> <body> <?php mysql_connect("localhost","root",""); mysql_select_db("test"); $result=mysql_query("select * from jud"); ?> <form method="get" name="myForm" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <select name="judet" onChange="javascript:mySubmit();"> <option>Please select</option> <?php while($row=mysql_fetch_array($result)){ $judet=$row['judet']; echo "<option>"; if (!isset($judet)){ echo $_GET['judet']; } else echo $judet; echo "</option>"; } ?> </select> </form> <form action="x.php" name="myFormSubmit" method="post"> <?php $judet=$_GET['judet']; $result1=mysql_query("select * from orase where id_oras = '$judet'"); ?> <select name="oras"> <?php while($row=mysql_fetch_array($result1)){ $oras=$row['oras']; echo "<option>"; echo $oras; echo "</option>"; } ?> </select> <input name="Submit" type="submit" value="GO" /> </form> </body> </html> Would apreciate any ideea.thanks Quote Link to comment Share on other sites More sharing options...
revraz Posted March 12, 2008 Share Posted March 12, 2008 session? Quote Link to comment Share on other sites More sharing options...
porta325 Posted March 12, 2008 Author Share Posted March 12, 2008 Problem is that result page after submit is the same file. 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.