0

Hi guys!
I'm trying to make a PHP mailer and I have a little problem with the eregi() function.
This is the code:

if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,6}$", $senders_email))
	{
	$error = "1";
	$info_error .= $lang_invalidemail . "<br>"; 
	}

and it gives me this error:
Deprecated: Function eregi() is deprecated in D:\wamp\www...
I've tried with !preg_match() but it didn't worked too.

Also I have this error: Notice: Undefined variable: info_error in...
for this code:

if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,6}$", $senders_email))
	{
	$error = "1";
	The same code but the error is here>>$info_error .= $lang_invalidemail . "<br>"; 
	}

Thanks in advance!

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by didi00
0

What doesn't work about preg_match?
Don't worry about notices. In this case, it is only a problem if magic quotes are on. You could put $info_error=''; somewhere above that line.

0

It worked like this:

if (!preg_match("/^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,6}$/i", $senders_email))
	{
	$error = "1";
	$info_error='';
	$info_error .= $lang_invalidemail . "<br>"; 
	}

I've forgot to add / in front of ^ in the beginning.
Thanks!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.