Question

I have a form that has a drop down for up to 10 items:

<label class="label"># of Items:</label><select name="itemNumber">

<?php 

for($i=1; $i<=10; $i++)
{
    echo "<option value=".$i.">".$i."</option>";
}?> 
<option name="Items"> </option>   
</select> 

Depending on what the user selects I need them to input a list of items. For example:

Select: 3

(The user would input the apparel)

Input:

  • Item 1: Levi's Jeans
  • Item 2: Nike Shoes
  • Item 3: Red Baseball Cap

What is the best way to achieve this? How should I store that data?

Was it helpful?

Solution

You can set a onchange event to the select. You read the changed value and create fields (number of fields according to the changed value) where the user can fill with the data. You can do this using jquery or javascript.

Check if this is what you want (using jquery): http://jsfiddle.net/67NHf/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top