chen2424 Posted November 5, 2009 Share Posted November 5, 2009 hi guys, I have 1 table jos_abc and i want to pull 2 fields tt reside in this table into my form in 2 dropdowns. 1 is brand and 1 is flavour. So if brand is dropdown and benjerrys is selected, flavour dropdown will show flavours only for benjerrys. kind of like this http://www.whatcar.com/ but i dont need the ajax. js is fine. this is what i have so far, hw do i write rest of code? any insight pls, <?php if(isset($_POST['action'])) { // handle submitted form data // then redirect } ?> <html> <head> <title></title> </head> <body> <form method="post" action="<?=( $_SERVER['PHP_SELF'] )?>"> <select name="title" onchange="this.form.submit();"> <option value=""> -- Select --</option> <?php mysql_connect("localhost", "username", "password") or die(mysql_error()); mysql_select_db("mydb") or die(mysql_error()); $sql = 'SELECT id , brand FROM jos_icecream ORDER BY brand'; $result = mysql_query($sql); ?> </select><noscript> <input type="submit" value=" Refresh " /></noscript> <input type="submit" name="action" value=" Submit " /> </form> </body> </html> 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.