I have the following form:
<form action="taf.php" method="post>
<input type="text" name="from_email">
<input type="text" name="email_1">
<input type="text" name="email_2">
<input type="text" name="email_3">
<input type="submit" name="submit">
</form>
In the PHP script 'taf.php' I want to make sure that all the email addresses are valid. Please tell me if what I have put down is correct!!
Could I make things easy by instead of having... email_1, email_2, and email_3 just name them all to_email??PHP Code:function check_email ($from_email, $email_1, $email_2, $email_3) {
return (ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.'@'.'[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.'[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$',$from_email, $email_1, $email_2, $email_3));
}
if ($submit) {
if (! check_email ($from_email) || ! check_email ($email_1) || ! check_email ($email_2) || ! check_email ($email_3))
echo("One of the email addresses you provided was invalid!");
So then I would just have $from_email and $to_email



So then I would just have $from_email and $to_email

Bookmarks