php_newbie7z4 Posted September 19, 2007 Share Posted September 19, 2007 Hi this is my first time doing this - im having a problem with my contact form , when i fill in the form on the website it sends me the email but it doesn't send the info entered in the 'email' field, only get the info in from and message... ie: in my email i get From: test E-Mail: Message: test here is the php code <?php if(isset($_POST['submit'])) { $to = "my@emailaddress.com.au"; $subject = "CONTACT FORM"; $name_field = $_POST['name']; $email_field = $_POST['email']; $message = $_POST['message']; $body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message"; mail($to, $subject, $body); print "<meta http-equiv=\"refresh\" content=\"0;URL=ok.htm\">"; } else { echo "blarg!"; } ?> do you have any ideas on how i can fix this Thanks David Quote Link to comment Share on other sites More sharing options...
d22552000 Posted September 19, 2007 Share Posted September 19, 2007 verify that your form is actually the right email_forum or w/e your field name is, make sure that the form has the right form name and input value. Quote Link to comment Share on other sites More sharing options...
php_newbie7z4 Posted September 19, 2007 Author Share Posted September 19, 2007 verify that your form is actually the right email_forum or w/e your field name is, make sure that the form has the right form name and input value. i have checked and all seems ok... what else could it be? Quote Link to comment Share on other sites More sharing options...
d22552000 Posted September 19, 2007 Share Posted September 19, 2007 No clue... sorry I couldnt help Quote Link to comment Share on other sites More sharing options...
php_newbie7z4 Posted September 19, 2007 Author Share Posted September 19, 2007 can anyone else help me please? Quote Link to comment Share on other sites More sharing options...
AdRock Posted September 19, 2007 Share Posted September 19, 2007 can you post the code for your form Quote Link to comment Share on other sites More sharing options...
Stripy42 Posted September 19, 2007 Share Posted September 19, 2007 I've had just a quick thought, maybe it doesn't like the @ sign or maybe the dots in the email. my sight uses $to = "email@site.com"; $re = "Web Site - Contact Request"; $msg = "<p><b>Contact Request</b></p>"; $msg .= "<p><b>Message received from:</b> " . $name . "</p><p><b>" . "Email to Reply:</b> " . $email . "</p><p>"; $msg .= "<b>Regarding:</b><br /> " . $why . "</p><b>Message:</b><br /> " . $comments . "</p>"; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; "; $headers .= "charset=iso-8859-1\r\n"; $headers .= "From: $email \r\n"; mail($to,$re,$msg,$headers); Sometimes using . to join stuff behaves better, and I've also got $headers this might encode the @ sign better. Quote Link to comment 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.