Anyone have a quick solution or code that would allow me to edit the process.php file to only allow certain types of email to be entered into an email field on the form? For instance if I Only wanted to allow .org email addresses to be entered into the form and .com or .net or anything else would receive the standard email error message that the address entered is not valid.
Thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Process.php can check standard email syntax.
Assuming the variable you want to check is named "Email".
Here is the code that does this:
if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$Email)){
$error.="<li>Invalid email address entered";
$errors=1;
}
If you know your regular expression syntax, you can modify this section to do whatever you want.
$errors is the error flag
$error is the message that is passed to the next section in process.php.
You will see;
if($errors==1) echo $error;
else{
send email
modify data file
write thankyou page
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anyone have a quick solution or code that would allow me to edit the process.php file to only allow certain types of email to be entered into an email field on the form? For instance if I Only wanted to allow .org email addresses to be entered into the form and .com or .net or anything else would receive the standard email error message that the address entered is not valid.
Thanks.
Process.php can check standard email syntax.
Assuming the variable you want to check is named "Email".
Here is the code that does this:
if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$Email)){
$error.="<li>Invalid email address entered";
$errors=1;
}
If you know your regular expression syntax, you can modify this section to do whatever you want.
$errors is the error flag
$error is the message that is passed to the next section in process.php.
You will see;
if($errors==1) echo $error;
else{
send email
modify data file
write thankyou page
}