hi frndz, I am trying out the following thing: I have two dropdown boxes on a form. the contents of the both are retrieved from the database. the contents of second one are based on the selection from the first one. what i am doing is that i am using a submit function on the "onchange" event of first dropdown. what it does is that it refreshes the whole form. till now it is fine but i want to add a submit button on the form and set the action attribute of the form to suppose "index.php". when ever i choose from the first drop down, it takes me to "index.php" since the attribut is set to index.php. I do not want to do that as I want to pass the contents of the second form to index.php Please help
Viewing the JS source at http://www.google.com/webhp?complete=1&hl=en might give you some clues as to how the the client side part can be done.
When you select an element from the list... make a script called "refresh.php" which has your code to fetch elements for the second list. Use THAT in your "onchange" event... and let the form action be index.php. You could actually do with index.php too... like call something like index.php?action=populate and then add similar code to the PHP script if ($action = "populate") { blahblah; <--- Your "refresh" code comes here } Code (markup):
take a look at an example on my site: http://sarahk.pcpropertymanager.com/muck/example.php which does what you need. I have the code working live on another site but it's hidden behind a restricted login process so can't show you right now. Sarah