...

View Full Version : validate



urgido
06-20-2006, 05:24 AM
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

Fumigator
06-20-2006, 06:27 AM
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:



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

urgido
06-20-2006, 10:18 AM
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

harsh789
06-20-2006, 02:59 PM
if ( (strstr($_POST['NewEmail'], '@')=="@myisp.com" )
{
//proceed
}
else
{
// exit
}

urgido
06-21-2006, 04:49 AM
Tell me please what is wrong:



## email
$FormData[3] = if ( (strstr($_POST['NewEmail'], '@')=="@myisp.com"));
{
//proceed
}
else
{
// exit
}
## end email

urgido
06-22-2006, 06:48 AM
:( Oh my god!

urgido
06-22-2006, 07:40 AM
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?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum