Jump to content

JavaScript and PHP Form Validation Question


glenelkins

Recommended Posts

Hi

Ok so i create 15 email fields in the following way (PHP):

[code]
for ($i=1;$i<15;$i++) {
  ?>
  <tr>
    <td>
      <input type="text" name="email[]">
    </td>
  </tr>
  <?
}
?>
[/code]

Then when the form is submitted it uses javascript onClick to run a validation function (JavaScript):

[code]
if(document.frmDetails.recemail.value==""){
    blnValid=false;
    strAlert+="The receipient's email address\n";
}
[/code]

This function was written when there was only a single email field, how do i write the code to loop through each of the email text fields in the array??

Cheers

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.