Php Email Form Question

admin

Administrator
Staff member
<!--fonto:Geneva--><span style="font-family:Geneva"><!--/fonto--><!--sizeo:1--><span style="font-size:8pt;line-height:100%"><!--/sizeo--><!--coloro:black--><span style="color:black"><!--/coloro--><br />Hi all,<br /><br />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?).<br /><!--sizec--></span><!--/sizec--><!--colorc--></span><!--/colorc--><!--fontc--></span><!--/fontc--><br /><br /><!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec--><?php<br />$to = "[email protected]";<br />$from_header = "From: $Name <$Email>";<br />if($Email != "") {<br />mail($to,"Subject","\n$Name\n$Email\n\nComments...\n$Message\n",$from_header);<br />???nbsp; print ("<b>Your note has been sent!?Send another if you like!</b><br>");<br />}<br />else { <br />???echo "<b>Send me a note!</b><br>";<br />}<br />?><br /><form method="POST" action="<? echo ($PHP_SELF); ?>"><br /><br />Name:??<input type="text" name="Name" size="30" maxlength="30"><br />E-mail:?<input type="text" name="Email" maxlength="30" size="30"><br />Message:<br />????nbsp; <textarea name="Message" wrap rows="5" cols="30"></textarea><br /><br />????nbsp; <input type="submit" name="submit" value="Send">???nbsp; <input type="reset" name="reset" value="Clear"><br /><br /></form><!--QuoteEnd--></div><!--QuoteEEnd--><br /><br /><!--fonto:Geneva--><span style="font-family:Geneva"><!--/fonto--><!--sizeo:1--><span style="font-size:8pt;line-height:100%"><!--/sizeo--><!--coloro:black--><span style="color:black"><!--/coloro--><br />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! <br /><br />any help is appreciated <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> ,<br />!!blue<br /><br /><!--sizec--></span><!--/sizec--><!--colorc--></span><!--/colorc--><!--fontc--></span><!--/fontc--><!--content-->
This script checks mail validity etc. and is totally customisable + easy to work.<br /><a href="http://www.ace-installer.com/perl-aceformmail.html" target="_blank">http://www.ace-installer.com/perl-aceformmail.html</a><br />Maybe the source will help?<!--content-->
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.<br /><br />No sense reinventing the wheel.<!--content-->
<!--fonto:Geneva--><span style="font-family:Geneva"><!--/fonto--><!--sizeo:1--><span style="font-size:8pt;line-height:100%"><!--/sizeo--><!--coloro:black--><span style="color:black"><!--/coloro--><br /><br />Surefire, thank you!<br /><br />I will see what I can learn from your files and hopefully I will make it work. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> <br /><br />later,<br />!!blue<br /><br /><!--sizec--></span><!--/sizec--><!--colorc--></span><!--/colorc--><!--fontc--></span><!--/fontc--><!--content-->
just checked it out surefire.<br />Awsome script. . . now I'll have another sleepless night coding it into my site. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/blink.gif" style="vertical-align:middle" emoid=":blink:" border="0" alt="blink.gif" /> <br /> Thumbs Up<!--content-->
Thanks for the kudos. Enjoy.<!--content-->
Nat, that is a great site, Thanks!<br /><br /><!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec--><a href="http://www.ace-installer.com/" target="_blank">http://www.ace-installer.com/</a><!--QuoteEnd--></div><!--QuoteEEnd--><!--content-->
 
Back
Top