Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jun 2009
    Posts
    351
    Thanks
    75
    Thanked 0 Times in 0 Posts

    Form Validation Help

    Hi Guys..

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

    The thing is i have no form validation so it could get attacked by bots..

    How do i get people to enter correct information 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...

    PHP Code:
    $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

  • #2
    Regular Coder
    Join Date
    Jun 2009
    Posts
    351
    Thanks
    75
    Thanked 0 Times in 0 Posts
    Can Anybody help??

  • #3
    New Coder
    Join Date
    Jun 2009
    Posts
    14
    Thanks
    0
    Thanked 1 Time in 1 Post
    You may want to check out this PHP script: http://www.phpclasses.org/browse/package/4425.html


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •