Sending the same form with 1 different field n number of times
<p>Right now, I have 3 part of my code working:</p>

<ul>
<li>I have a form that I wish to add n number of names.</li>
<li>The names are put into an array.</li>
<li>A loop iterates through the array with a delay</li>
</ul>

<p>But I want to submit the form on every iteration with the new name attached.</p>

<p>The form is always submitted (target is an iframe) with the last name yet you can see from my debugging commented out code that an alert will pop up (with a delay) for every name in the array.</p>

<pre><code>&lt;script&gt;
function getUsers() 
{
    var separateUsers = document.getElementById("Requestors").value.split("\n");
    //document.write(separateUsers[1]);
    for (var i=0;i&lt;separateUsers.length;i++)
    {
        sleep(400);
        document.sendForm.userName.value = (separateUsers[i]);
        //alert("Loop iteration "+separateUsers[i]+ " " +i+ " out of"+ i);
        document.getElementById("sendForm").submit();
        //document.write(sendForm.userName.value);
    }
}

function sleep(ms)
{
    var dt = new Date();
    dt.setTime(dt.getTime() + ms);
    while (new Date().getTime() &lt; dt.getTime());
}   

&lt;/script&gt;

&lt;form name ="sendForm" id="sendForm" action="form.php" method="post" enctype="multipart/form-data" target="theTarget"&gt;
    &lt;input type="hidden"  name="userName" id="userName" value="" /&gt;
&lt;/form&gt;

&lt;form name ="initialForm"&gt;
    &lt;textarea name="Requestors" cols="10" rows="10" value= ""&gt;&lt;/textarea&gt;
    &lt;input type="button" onclick="getUsers()" value="Submit" /&gt;
&lt;/form&gt;
&lt;iframe id="theTarget" name ="theTarget" &gt;&lt;/iframe&gt;
</code></pre>
