HI, I want to stop people setting their e-mail address as info or sales etc, so they have to use a personal email address, i.e. ben@domain.com. So I wrote the following, but I get a parse error, does anyone know why? if ($email LIKE 'info@' || 'sales@' || 'webmaster@' || 'postmaster@' || 'accounts@') { $feedback .= ' ERROR - Please Provide Personal E-mail Address '; return false; }
Thanks Ben
"LIKE" syntax is for SQL queries, however, not a valid comparison operator in PHP.
You should read the PHP documentation on Regular Expressions (what would be needed to accomplish this sort of test).
Scott A. Hammond, Sr., CEO Prima Internet, Inc.
I looked on php.net for 'LIKE' and 'simular' to see if there was a function to match simular text, but couldn't find anything. Do you have any suggestions as to what I can use?
Look at the sections on Regular Expressions:
http://www.php.net/manual/en/
Ah, so I should use preg_match! Like
if (preg_match ("info@", "$email")){ $feedback .= ' ERROR - Please Provide Personal E-mail Address '; return false; }