What I want to do is to create a feature that creates fields based on what the user selects
For example;
<select name="ex">
<option selected="selected" value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
If the user selected 4, I want to be able to display 4 input fields
My question was, how would I construct a query that would do this?
I rattled my brain and all I could come up with was
if($ex='4') {
<input type="text" name="field4">
<input type="text" name="field4">
<input type="text" name="field4">
<input type="text" name="field4">
}
But there has to be an easier way of displaying them. Any ideas?
If would be easier if you use
forloop , like as follows :I hope it helps.