Jump to content

Archived

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

Terfanda

Email Validation

Recommended Posts

function emailcheck($Email)
{
if (eregi("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$]", $Email))
{
$ans1=FALSE;
}
else
{
$ans1= TRUE;
}
return $ans1;

}




Hello agian I will be very thankfull if someone help I am using this function up it seems it is wrong can someone tells me where is my mistake

i am calling it here:::::: $acc=emailcheck("$Email");

and i am using this if condition to give me a final answer::::: if (($acc==TRUE)AND($acc1==TRUE))


I will be very greatfull if someone helps me thank you

Share this post


Link to post
Share on other sites
This is what I did, hope you know where you went wrong.
[code]<?php

function validateEmail($email)
{
    $email_pattern = '^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$';
    if (eregi ($email_pattern, $email) )
    {
        $ans1 = TRUE;
    }
    else
    {
        $ans1 = FALSE;
    }
    return $ans1;
}

if (validateEmail("hackerkts@gmail.com") == TRUE) {
    echo "TRUE";
    } else {
        echo "FALSE";
        }
?>[/code]

Share this post


Link to post
Share on other sites
[!--quoteo(post=385892:date=Jun 20 2006, 10:08 AM:name=hackerkts)--][div class=\'quotetop\']QUOTE(hackerkts @ Jun 20 2006, 10:08 AM) [snapback]385892[/snapback][/div][div class=\'quotemain\'][!--quotec--]
This is what I did, hope you know where you went wrong.
[code]<?php

function validateEmail($email)
{
    $email_pattern = '^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$';
    if (eregi ($email_pattern, $email) )
    {
        $ans1 = TRUE;
    }
    else
    {
        $ans1 = FALSE;
    }
    return $ans1;
}

if (validateEmail("hackerkts@gmail.com") == TRUE) {
    echo "TRUE";
    } else {
        echo "FALSE";
        }
?>[/code]
[/quote]


[!--quoteo(post=385887:date=Jun 20 2006, 08:16 AM:name=Terfanda)--][div class=\'quotetop\']QUOTE(Terfanda @ Jun 20 2006, 08:16 AM) [snapback]385887[/snapback][/div][div class=\'quotemain\'][!--quotec--]
function emailcheck($Email)
{
if (eregi("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$]", $Email))
{
$ans1=FALSE;
}
else
{
$ans1= TRUE;
}
return $ans1;

}

Hello agian I will be very thankfull if someone help I am using this function up it seems it is wrong can someone tells me where is my mistake

i am calling it here:::::: $acc=emailcheck("$Email");

and i am using this if condition to give me a final answer::::: if (($acc==TRUE)AND($acc1==TRUE))
I will be very greatfull if someone helps me thank you
[/quote]


Thank You
I understood it and i will try it

Share this post


Link to post
Share on other sites

×

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.