Jump to content

Need help with this form validation


kevinkhan

Recommended Posts

Hi Guys..

 

I have set up a form on my site www.eventpromotion.ie..

 

The thing is i have no form validation

 

i want to get people to enter correct information into each of the fields. Like the name input box i only want to allow them enter max 10 letters for each of the first and second name..

 

for the mobile.. i only want a ten digit number the begins with either 087, 086, 083 or 085...

 

and the email input box i want to format as well..

 

any ideas... for the names i set this up...

 

$fields_with_lengths = array('firstName' => 10);
        foreach($fields_with_lengths as $fieldname => $maxlength)
          {
          if(strlen(trim(mysql_prep($_POST[$fieldname]))) > $maxlength) 
            {
            $errors[] = $fieldname;
            }
          }

 

I set up an error array to extract which fields have errors in them..

 

I need help with the mobile and email field..

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/189765-need-help-with-this-form-validation/
Share on other sites

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.