PhoenixDown
Programmer
I posted this before but it didn't fix my problem.
Now, this code checks if a valid email is entered and if http:// is there. What I want it to do is to not display any errors if someone didn't enter anything in the field. If they did, the script will check to see if it's a valid email address, or if http:// is there. Can someone fix that for me. Thank you. - Go there!
Code:
if ($vars_gen{'Field2Data'} eq "email") {
if (($in{'Field2'} eq "") || ($in{'Field2'} !~ /\w+@\w+\.\w+/)) {
&GBStandardHTML("You have entered an invalid email address. Your email address must contain an ampersand (@), a period (.), and at least one letter or number.", "<meta http-equiv=\"refresh\" content=\"$vars_gen{'Secs'};URL=$vars_gen{'CGIURL'}gb.cgi?action=add_entry\">");
exit;
}
}
if ($vars_gen{'Field2Data'} eq "url") {
if (($in{'Field2'} eq "") || ($in{'Field2'} !~ /http:\/\/.*?\.\w+/)) {
&GBStandardHTML("You have entered an invalid URL for the $vars_gen{'Field2Name'} field. Your URL must include the [URL unfurl="true"]http://.");[/URL]
exit;
}
}
Now, this code checks if a valid email is entered and if http:// is there. What I want it to do is to not display any errors if someone didn't enter anything in the field. If they did, the script will check to see if it's a valid email address, or if http:// is there. Can someone fix that for me. Thank you. - Go there!