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 7 of 7

Thread: validate

  1. #1
    Regular Coder
    Join Date
    Aug 2005
    Posts
    257
    Thanks
    8
    Thanked 0 Times in 0 Posts

    validate

    How I can validate a field for a php form? The name of the field is "NewEmail" and if the email is @myisp.com that is correct but if the email is @yahoo.com or similar the sentence is false. Regards

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts

    Netscape

    I'm confused-- you want to make sure someone doesn't use a yahoo email address, and only a yahoo email address? You could just check for that string using substr_count:

    PHP Code:
    if (strtoupper(substr_count($_POST['NewEmail']), '@YAHOO.COM')) > 0) {
        print 
    "invalid email<br>\n";


  • #3
    Regular Coder
    Join Date
    Aug 2005
    Posts
    257
    Thanks
    8
    Thanked 0 Times in 0 Posts
    I want to do is that the users only could register if they use @isp.com if they use another provider (like yahoo, hotmail, etc) the system the rejected. Regards

  • #4
    Regular Coder
    Join Date
    May 2006
    Posts
    101
    Thanks
    0
    Thanked 1 Time in 1 Post
    if ( (strstr($_POST['NewEmail'], '@')=="@myisp.com" )
    {
    //proceed
    }
    else
    {
    // exit
    }

  • #5
    Regular Coder
    Join Date
    Aug 2005
    Posts
    257
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Tell me please what is wrong:


    PHP Code:
    ## email
            
    $FormData[3] = if ( (strstr($_POST['NewEmail'], '@')=="@myisp.com"));
            {
            
    //proceed
            
    }
            else
            {
            
    // exit
            
    }
    ## end email 
    Last edited by urgido; 06-22-2006 at 01:56 AM.

  • #6
    Regular Coder
    Join Date
    Aug 2005
    Posts
    257
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Oh my god!

  • #7
    Regular Coder
    Join Date
    Aug 2005
    Posts
    257
    Thanks
    8
    Thanked 0 Times in 0 Posts
    PHP Code:
    if(strstr($_POST['NewEmail'], '@')=="")
    {
    //sigue

    else if(
    strstr($_POST['NewEmail'], '@')=="@logymail.com")
    {
    $FormData[3] = trim(strip_tags($_POST['NewEmail']));
    }
    else {
    $ErrorMessage $Language['register']['error3'];

    WHAR IS WRONG HERE?


  •  

    Posting Permissions

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