email validation error
Posted: Thu Apr 02, 2009 7:19 am
i m trying to validate the email address before entering into the database ....
problem....its giving error in emailid field irrespective of whether id is right or wrong.
this is wat i created...plz help ...and when u make corrections plz highlight wat u added n wat u removed in different colors so i can easily understand...thanx i m getting the error as follows
Notice: Undefined variable: emailid in D:\wamp\www\php_stockphotos\new_user.php on line 35
Warning: ereg() [function.ereg]: REG_BADRPT in D:\wamp\www\php_stockphotos\new_user.php on line 35
line no 3. is line no. 35 in the following
add_user.php
problem....its giving error in emailid field irrespective of whether id is right or wrong.
this is wat i created...plz help ...and when u make corrections plz highlight wat u added n wat u removed in different colors so i can easily understand...thanx i m getting the error as follows
Notice: Undefined variable: emailid in D:\wamp\www\php_stockphotos\new_user.php on line 35
Warning: ereg() [function.ereg]: REG_BADRPT in D:\wamp\www\php_stockphotos\new_user.php on line 35
line no 3. is line no. 35 in the following
add_user.php
Code: Select all
if ( empty($errors) )
{
if ( ereg ($pattern,$emailid))
{
$query = "INSERT INTO users (username, hashed_password, emailid
)
VALUES ('{$username}', '{$hashed_password}', '{$emailid}'
)";
$result = mysql_query($query, $connection);
if ($result) {
$message = "Request for your account has been sent to the admin...wait for ";
$message .= "email confirmation";
$username = "";
$password = "";
$emailid = "";
redirect_to('basic.php');
}
else {
$message = "The user could not be created.";
}
}
else
{
$message = "Enter a valid email address";
}
else
{
if (count($errors) == 1) {
$message = "There was 1 error in the form.";
} else {
$message = "There were " . count($errors) . " errors in the form.";
}
}