SitePoint Sponsor |
|
User Tag List
Results 1 to 2 of 2
Thread: help!! I'm stuck on something...
-
Sep 7, 2001, 16:29 #1
help!! I'm stuck on something...
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!!
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
-
Sep 8, 2001, 03:08 #2
- Join Date
- Mar 2001
- Location
- Medina, OH
- Posts
- 440
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Well for starters by requiring the variables $from_email, $email_1, $email_2, and $email_3 to be there, you are then calling your function incorrectly. You'd call it like this:
PHP Code:if (!check_email($from_email,$email_1,$email_2,$email_3)) {
echo "One of the...";
}
Kevin
Bookmarks