Jump to content


Photo

JavaScript and PHP Form Validation Question


  • Please log in to reply
1 reply to this topic

#1 glenelkins

glenelkins
  • Members
  • PipPipPip
  • Advanced Member
  • 760 posts
  • LocationBridlington - East Riding of Yorkshire - United Kingdom

Posted 29 May 2006 - 09:52 AM

Hi

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

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

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

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

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
http://thewebsolutionprovider.com - A Solution For Everything Web!

#2 glenelkins

glenelkins
  • Members
  • PipPipPip
  • Advanced Member
  • 760 posts
  • LocationBridlington - East Riding of Yorkshire - United Kingdom

Posted 29 May 2006 - 03:55 PM

So is noone going to help me with this?
http://thewebsolutionprovider.com - A Solution For Everything Web!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users