I have a refer a friend page that looks like this:
<form name=friend action=$PHP_SELF method=post>
Friends Name
<input type=text name=name[] size=20>
Friends E-mail
<input type=text name=email[] size=20>
Friends Name
<input type=text name=name[] size=20>
Friends E-mail
<input type=text name=email[] size=20>
Friends Name
<input type=text name=name[] size=20>
Friends E-mail
<input type=text name=email[] size=20>
Friends Name
<input type=text name=name[] size=20>
Friends E-mail
<input type=text name=email[] size=20>
<input type=submit>
</form>
For the purpose of debugging, I added:
for ($i=x; $i < 4; $i++) {
echo "$x $name[$x] $address[$x]<br />";
}
the output looks like this:
0 name1
1
2
3 email1
I enter a name in the first name <input> and an email in the first email <input>, but the email address is assigned to index 3 not index 1.
This only happens on the first <input> fields on the first submission. After I submit the first time, it all works as expected. What the hell?