How to Generate a Set of Textboxes from a Dropdown Menu Autofilled with Random Numbers?
<p>I would like to use a dropdown menu to allow the selection of a set number of three textboxes where each number set of textboxes should contain a unique set of numbers. Currently, the dropdown menu does create the desired number of sets of textboxes, for example, selecting 5 generated a set of 5 textboxes filled with random numbers. The problem is that they are all the same sets of random numbers. </p>

<p>I would like something where a selected number in the dropdown menu would generate the desired sets of textboxes, then clicking on a Generate Numbers button would fill the sets of textboxes with random numbers where each set is unique. Can this be done with Javascript, JQuery or do I need to use something else?</p>

<p>Here's my code so far. Thank you very much for your help.</p>

<pre><code>&lt;?php
//generate set of random numbers from 1 to 10000
function RandomNumbers($min, $max, $quantity) {
    $numbers = range($min, $max);
    shuffle($numbers);
    return array_slice($numbers, 0, $quantity);
}
$num = (RandomNumbers(1,10000,10000));
$random1 = $num[0];
$random2 = $num[1];
$random3 = $num[2];
?&gt;

&lt;html&gt;
&lt;head&gt;
&lt;script type='text/javascript' src='js/jquery.js'&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;script type="text/javascript"&gt;
//this is the code which I am not sure how to develop &gt;&gt;&gt;
    $(document).ready(function(){
        $counter = 0; // initialize 0 for limiting textboxes
        $('#dropdownadd').change(function(){
            $('#dropdowndiv').html(""); // when the dropdown change set the div to empty
            $loopcount = $(this).val(); // get the selected value
            for (var i = 1; i &lt;= $loopcount; i++)
            {
                //this adds textboxes using dropdown menu but inserts the same number set into each set of textboxes
                $('#dropdowndiv').append('&lt;div&gt;&lt;form&gt;Number Set #'+i+'&lt;input type="text" name="num1" class="textbox1" value="&lt;?php echo $random1; ?&gt;" /&gt;&lt;input type="text" name="2" class="textbox2" value="&lt;?php echo $random2; ?&gt;" /&gt;&lt;input type="text" name="3" class="textbox3" value="&lt;?php echo $random3; ?&gt;" /&gt;&lt;/div&gt;'); 
            }
        });
    });
&lt;/script&gt;


&lt;div id="dropdowndiv"&gt;
&lt;!-- this is where textboxes will appear --&gt;
&lt;/div&gt;
&lt;div class="choices"&gt;
    &lt;span&gt;Adding Textboxes using Dropdown Menu&lt;/span&gt;
    &lt;select id="dropdownadd"&gt;
        &lt;option value="0"&gt;0&lt;/option&gt;
        &lt;option value="1"&gt;1&lt;/option&gt;
        &lt;option value="2"&gt;2&lt;/option&gt;
        &lt;option value="3"&gt;3&lt;/option&gt;
        &lt;option value="4"&gt;4&lt;/option&gt;
        &lt;option value="5"&gt;5&lt;/option&gt;
        &lt;option value="10"&gt;10&lt;/option&gt;
        &lt;option value="20"&gt;20&lt;/option&gt;
    &lt;/select&gt;
&lt;/div&gt;
&lt;/html&gt;

&lt;HTML&gt;
&lt;form name="form" method="post"&gt;
&lt;input type="text" name="num1" id="var1" value="&lt;?php echo $random1; ?&gt;" &gt;
&lt;input type="text" name="num2" id="var1" value="&lt;?php echo $random2; ?&gt;" &gt;
&lt;input type="text" name="num3" id="var1" value="&lt;?php echo $random3; ?&gt;" &gt;
&lt;br&gt;
&lt;input type="submit" name="submit" value="Generate Numbers"&gt;
&lt;/form&gt;
&lt;/HTML&gt; 
</code></pre>
