Ummm....but how does you JS code know WHICH ONE of those many <input>s it should be referring to???
Let's write this in pure HTML just to demo:
Code:
<input type="hidden" name="unique" id="x7312" value="" />
<input type="hidden" name="unique" id="ar541" value="" />
<input type="hidden" name="unique" id="p819" value="" />
<input type="hidden" name="unique" id="g713" value="" />
Okay, so now your JS code does:
Code:
var hidden = document.getElementById("??? what do you put here???");
See what I mean? WHICH ONE of those fields do you want to get in the JS code???
Incidentally, if this <form> is going to be sent to a subsequent PHP page, and if you want to be able to get the values of any and all of those hidden fields on that PHP page, then you *must* use
Code:
<input type="hidden" name="unique[]" id="..whatever.." value="" />
Same as when you use multiple checkboxes with the same name.
Not to ask a dumb *** question, but would it be adequate to do this???
Code:
<?php
$unique = 0;
while ( ... some loop creating all this stuff ... )
{
++$unique;
...
?>
...
<input type="hidden" name="unique<?php echo unique;?>" value="" />
...
<?php
}
?>
And now your JS code can do:
Code:
var which = 7; // or any other number
var hidden = document.FormName.elements["unique"+which];
...
And now, also, each of your form fields has a different name and you don't have to use [] to make them accessible in the subsequent PHP page.