!!blue Posted July 12, 2003 Posted July 12, 2003 Hi all, I found the following php email form online and was able to use it, however, I wanted to ask how I can make it check that the email contains an "@" sign. It only checks that the email box not be empty (right?). <?php$to = "zulema_ortiz@zoblue.com"; $from_header = "From: $Name <$Email>"; if($Email != "") { mail($to,"Subject","\n$Name\n$Email\n\nComments...\n$Message\n",$from_header); print ("<b>Your note has been sent! Send another if you like!</b><br>"); } else { echo "<b>Send me a note!</b><br>"; } ?> <form method="POST" action="<? echo ($PHP_SELF); ?>"> Name: <input type="text" name="Name" size="30" maxlength="30"> E-mail: <input type="text" name="Email" maxlength="30" size="30"> Message: <textarea name="Message" wrap rows="5" cols="30"></textarea> <input type="submit" name="submit" value="Send"> <input type="reset" name="reset" value="Clear"> </form> I know it should go in the * if($Email != "") * line, but I don't know how it should be worded. I want it to check if the text in the email box has an @ sign somewhere in it. It's prolly the easiest thing, but I don't know php! any help is appreciated , !!blue Quote
Digirunt Posted July 12, 2003 Posted July 12, 2003 This script checks mail validity etc. and is totally customisable + easy to work. http://www.ace-installer.com/perl-aceformmail.html Maybe the source will help? Quote
surefire Posted July 12, 2003 Posted July 12, 2003 There is a script I co-wrote in the scripting forum called Ultimate Form Mail Script. You can either 'borrow' the regex function that validates the email, or you may use the script as is. No sense reinventing the wheel. Quote
!!blue Posted July 12, 2003 Author Posted July 12, 2003 Surefire, thank you! I will see what I can learn from your files and hopefully I will make it work. later, !!blue Quote
Digirunt Posted July 12, 2003 Posted July 12, 2003 just checked it out surefire. Awsome script. . . now I'll have another sleepless night coding it into my site. Thumbs Up Quote
TCH-Don Posted July 13, 2003 Posted July 13, 2003 Nat, that is a great site, Thanks! http://www.ace-installer.com/ Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.