zjp Posted July 6, 2006 Share Posted July 6, 2006 <?php if ( $REQUEST_METHOD == "POST" ) { $realname = strip_tags($realname); $email = strip_tags($email); $feedback = strip_tags($feedback); $sendto = "zjp19831102@163.com"; $subject = "order request"; $message = "$realname, $email\n\n$feedback"; mail($sendto, $subject, $message); } ?> <?php if ($REQUEST_METHOD=="POST") { echo("<p><b>Thank you for your feedback. The following message was sent:</b></p>\n"); echo("<blockquote><pre>\n"); echo("$message"); echo("</pre></blockquote>"); ?> <meta http-equiv="refresh" content="5"> <? } else {?><script language="javascript"> function DoSubmit () { if (document.form.realname.value == "") { alert ("You forgot to enter your name."); document.form.realname.focus (); return ""; } if (document.form.email.value == "") { alert ("You forgot to enter your email."); document.form.email.focus (); return ""; } if (document.form.reedback.value == "") { alert ("You forgot to enter your feedback. "); document.form.reedback.focus (); return ""; } document.form.submit (); } </script> <form action="<?php echo("$script_name"); ?>" METHOD="POST" name="form"> <table cellpadding="4" cellspacing="0" border="0"> <tr><td><b>Name: </b></td><td><input type="text" name="realname" size="25"></td></tr> <tr><td><b>Email:</b></td><td><input type="text" name="email" size="25"></td></tr> <tr><td colspan=2><b>Feedback:</b><br /> <textarea name="feedback" rows="12" cols="45" wrap="physical"></textarea> </td></tr> <tr><td colspan="2" align="center"><input type="submit" onclick="DoSubmit ()" value="send"></td></tr> </table> </form><?php } ?> ??? ??? ??? ??? ???This code can't send the mail ,who can tell me where i'm wrong ! Thanks a lot!!!! Quote Link to comment https://forums.phpfreaks.com/topic/13819-how-to-send-mail-by-php/ Share on other sites More sharing options...
hackerkts Posted July 6, 2006 Share Posted July 6, 2006 $REQUEST_METHOD o.O What's thatOr are you trying to mean [code]$_REQUEST[/code][b]Edit[/b]:Check out on this site, hope it helps you.http://www.thesitewizard.com/archive/feedbackphp.shtml Quote Link to comment https://forums.phpfreaks.com/topic/13819-how-to-send-mail-by-php/#findComment-53727 Share on other sites More sharing options...
.josh Posted July 6, 2006 Share Posted July 6, 2006 so...what do you mean by it "can't" send the mail? are you getting an error message of some kind? are you getting your "Thank you for your feedback. The following message was sent:" but it wasn't sent? please provide as much details as possible. and by the way:[code]$realname = strip_tags($realname);$email = strip_tags($email);$feedback = strip_tags($feedback);[/code]unless register_globals is set to ON in your php.ini this won't work. you need to do this:[code]$realname = strip_tags($_POST['realname']);$email = strip_tags($_POST['email']);$feedback = strip_tags($_POST['feedback']);[/code]and it should be $_SERVER['REQUEST_METHOD'] unless register_globals is set to ON, as well. but even if it IS set to ON, you shouldn't use your variables as you are using them. you should be using $_POST and $_SERVER for security reasons. Quote Link to comment https://forums.phpfreaks.com/topic/13819-how-to-send-mail-by-php/#findComment-53729 Share on other sites More sharing options...
zjp Posted July 6, 2006 Author Share Posted July 6, 2006 Thank you ,i try it Quote Link to comment https://forums.phpfreaks.com/topic/13819-how-to-send-mail-by-php/#findComment-53734 Share on other sites More sharing options...
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.