Just spent far too long trying to figure out how to do this, so I thought I'd pass it on to you great guys, in case you need it for the future. I used PHP to create multiple form rows, each one numbered:
<? for ($i =1; $i <= 20; $i++) { echo("<input type=text name=userId$i maxlength=5/><br/>"); } ?> This creates a number of rows, each with a unique form value name. The problem I had was that I needed to validate those rows, to make sure they were numeric... Here's what I did. Have fun! <?php $numRows = 20; ?> <html> <head> <title>User ID Entry Example</title> <script language="JavaScript"> function isNumeric(strString) { var strValidChars = "0123456789-."; var strChar; var blnResult = true; if (strString.length == 0) return false; // test strString consists of valid characters listed above for (i = 0; i < strString.length && blnResult == true; i++) { strChar = strString.charAt(i); if (strValidChars.indexOf(strChar) == -1) { blnResult = false; } } return blnResult; } function validateForm() { for (var i = 1; i <= <?= $numRows ?>; i++) { var fieldName = 'UserId' + i; var fieldValue = document.forms.userForm.elements[fieldName].value; if (fieldValue != '' && ! isNumeric(fieldValue)) { alert("Field value in row " + i + " (" + fieldValue + ") is not numeric."); return false; } } return true; } </script> </head> <body> <form name="userForm" action="process_form.php" method="post" onSubmit="return validateForm()"> <?php for ($i =1; $i <= $numRows; $i++) { echo("<input type=text name=userId$i maxlength=5/><br/>"); } ?> </form> </body> </html> ============================================================================== This message is for the sole use of the intended recipient. If you received this message in error please delete it and notify us. If this message was misdirected, CSFB does not waive any confidentiality or privilege. CSFB retains and monitors electronic communications sent through its network. Instructions transmitted over this system are not binding on CSFB until they are confirmed by us. Message transmission is not guaranteed to be secure. ==============================================================================