How can a web form drop-down list spawn a text field?
Posted on 2009-07-09
I am currently running a website that has an application form that gets submitted via email via PHP. I would like to add to this form a drop down list that, depending on the choice in the list, will spawn new text fields. For example, the drop down might list:
Your favorite food:
If the user selects "Salad", it would spawn a text field like "Your favorite dressing", letting the user type in their favorite dressing. If the user selects "Pizza" it would spawn three text fields like "Most favorite topping", "Second favorite topping", and "Most hated topping", where the user would type in the toppings as applicable.
Also, I am pretty sure I can figure the submission for the fields out on my own (since I do it already for the other fields). My question really is getting this "if-then" behavior implemented.