what i want to do is show form based on the value of a dropdown list. like if value 2 then what appears is two forms of the same form.
example:
<div>
How many?
<select name="options">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</div>
<div id="test">
</div>
<form id="form1">
<table>
<tr><td>Name :</td><td><input type="text" name="name"></td></tr>
<tr><td>Email : </td><td><input type="email" name="email"></td></tr>
<tr><td><input type="submit" name="submit" value="Submit"></td></tr>
</table>
</form>
so say value="3"
is selected then form1
will be shown in <div id="test">
3 times one after the other.
im thinking maybe use .append()
, like append form1
into test
. but how to append the form based on the value from the drop down list? wouldn't the input type="text"
need different names? coz the forms will be submitted into database.
thanks in advance!