views:

104

answers:

1

I am creating a website in php with a form that teachers complete to tag each question on a test with a label. The labels are predetermined and listed in a set of drop down menus (one for each question on the test), but there is an option for users to click "add a new label" which pops up a another form in a new, smaller window (while keeping the contents of their original form intact).

Once the user adds their new label, how can I dynamically update the contents of the original drop down menus to include the new label, WITHOUT resetting the dropdown values that have already been set by the user?

Thanks for any advice. -Jen

+1  A: 

You'll need to use JavaScript to do this. JavaScript will allow you to modify the HTML of the web page after it has been loaded and rendered by the browser. If you need to update a database so it is aware of all of the possible drop down options you can use Ajax to send the new option to the server where a PHP script would add it to the database.

Using frameworks like jQuery and Prototype will make this easier to do then using raw JavaScript.

John Conde
Or dojo is another JaveScript framework, that I prefer.
Kitson