ssnavely76 Posted February 27, 2007 Share Posted February 27, 2007 I am having an issue with data not being sent to my email. The form works the way it should except for the data is coming up blank in my email that I recieve. This is the result from my test ------------------------------------------- E-MAIL SENT FROM http://www.domain.com Name: Phone: Email: Comments: -------------------------------------------- Below is what I have come up with. Can enyone please help ________________________________________________________________________________ Contactus.html ________________________________________________________________________________ <form method="POST" action="contact.php" onSubmit="return _CF_checkPaymentForm(this)"> <table width="300" border="0" cellpadding="0" cellspacing="0"> <tr align="left" valign="middle"> <td width="80" align="right" scope="row"><span class="bold">Name ::<br /> </span></td> <td><input name="name" type="text" id="name" onBlur="MM_validateForm('name','','R','phone','','R','email','','RisEmail');return document.MM_returnValue" size="20" /> </td> </tr> <tr align="left" valign="middle"> <td align="right" scope="row"> </td> <td> </td> </tr> <tr align="left" valign="middle"> <td align="right" scope="row"><span class="bold">Phone ::</span></td> <td><input name="phone" type="text" id="phone" size="20" /></td> </tr> <tr align="left" valign="middle"> <td width="80" align="right" scope="row"> </td> <td> </td> </tr> <tr align="left" valign="middle"> <td width="80" align="right" scope="row"><span class="bold">Email ::<br /> </span></td> <td><input name="email" type="text" id="email" size="20" /></td> </tr> </table> <table width="300" border="0" cellpadding="0" cellspacing="0"> <tr align="left" valign="middle"> <td width="80" scope="row"> </td> <td> </td> </tr> <tr align="left" valign="middle"> <td width="80" align="right" valign="top" scope="row"><span class="bold">Comments ::<br /> </span></td> <td><textarea name="comments" cols="30" rows="7" id="comments"></textarea> <br /> <br /> <input type="reset" name="Reset" value="Reset" /> <input type="submit" name="Reset2" value="Submit" /></td> </tr> </table> </form> _____________________________________________________________ contact.php _____________________________________________________________ <?php // this is the info that comes on the email when it's ok to send! $domain_url = "domain.com"; $msg = "E-MAIL SENT FROM http://www.".$domain_url . "\n"; $msg .= "Name: $name\n"; $msg .= "Phone: $phone\n"; $msg .= "Email: $email\n"; $msg .= "Comments: $comments\n"; $to = "domain.com"; $subject = $domain_url . " - Contact Us Web Form"; $mailheaders = "From: Contact Us ".$domain_url . " Web Form \n \n"; //$mailheaders .= "Reply-To: [email protected]\n\n"; mail($to, $subject, $msg, $mailheaders); header("Location: contact_thanks.htm"); ?> Link to comment https://forums.phpfreaks.com/topic/40299-data-isnt-being-sent-from-email-form/ Share on other sites More sharing options...
magic2goodil Posted February 27, 2007 Share Posted February 27, 2007 Please use code tags in the future. Contactus.html ________________________________________________________________________________ <form method="POST" action="contact.php" onSubmit="return _CF_checkPaymentForm(this)"> <table width="300" border="0" cellpadding="0" cellspacing="0"> <tr align="left" valign="middle"> <td width="80" align="right" scope="row"><span class="bold">Name :: </span></td> <td><input name="name" type="text" id="name" onBlur="MM_validateForm('name','','R','phone','','R','email','','RisEmail');return document.MM_returnValue" size="20" /> </td> </tr> <tr align="left" valign="middle"> <td align="right" scope="row"> </td> <td> </td> </tr> <tr align="left" valign="middle"> <td align="right" scope="row"><span class="bold">Phone ::</span></td> <td><input name="phone" type="text" id="phone" size="20" /></td> </tr> <tr align="left" valign="middle"> <td width="80" align="right" scope="row"> </td> <td> </td> </tr> <tr align="left" valign="middle"> <td width="80" align="right" scope="row"><span class="bold">Email :: </span></td> <td><input name="email" type="text" id="email" size="20" /></td> </tr> </table> <table width="300" border="0" cellpadding="0" cellspacing="0"> <tr align="left" valign="middle"> <td width="80" scope="row"> </td> <td> </td> </tr> <tr align="left" valign="middle"> <td width="80" align="right" valign="top" scope="row"><span class="bold">Comments :: </span></td> <td><textarea name="comments" cols="30" rows="7" id="comments"></textarea> <input type="reset" name="Reset" value="Reset" /> <input type="submit" name="Reset2" value="Submit" /></td> </tr> </table> </form> _____________________________________________________________ contact.php _____________________________________________________________ <?php // this is the info that comes on the email when it's ok to send! $domain_url = "domain.com"; $msg = "E-MAIL SENT FROM http://www.".$domain_url . "\n"; $msg .= "Name: $name\n"; $msg .= "Phone: $phone\n"; $msg .= "Email: $email\n"; $msg .= "Comments: $comments\n"; $to = "domain.com"; $subject = $domain_url . " - Contact Us Web Form"; $mailheaders = "From: Contact Us ".$domain_url . " Web Form \n \n"; //$mailheaders .= "Reply-To: [email protected]\n\n"; mail($to, $subject, $msg, $mailheaders); header("Location: contact_thanks.htm"); ?> Link to comment https://forums.phpfreaks.com/topic/40299-data-isnt-being-sent-from-email-form/#findComment-194951 Share on other sites More sharing options...
magic2goodil Posted February 27, 2007 Share Posted February 27, 2007 Before you can use post data you must grab the variable as $_POST['var'] from the $_POST array So for example whatever you named the variable in your form that sent you to this page, is what it would be in the post array. name = "test" then $_POST['test'] Here's what your code should be. _____________________________________________________________ contact.php _____________________________________________________________ <?php // this is the info that comes on the email when it's ok to send! $name = $_POST['name']; $phone = $_POST['phone']; $email= $_POST['email']; $comments = $_POST['comments']; $domain_url = "domain.com"; $msg = "E-MAIL SENT FROM http://www.".$domain_url . "\n"; $msg .= "Name: $name\n"; $msg .= "Phone: $phone\n"; $msg .= "Email: $email\n"; $msg .= "Comments: $comments\n"; $to = "domain.com"; $subject = $domain_url . " - Contact Us Web Form"; $mailheaders = "From: Contact Us ".$domain_url . " Web Form \n \n"; //$mailheaders .= "Reply-To: [email protected]\n\n"; mail($to, $subject, $msg, $mailheaders); header("Location: contact_thanks.htm"); ?> Link to comment https://forums.phpfreaks.com/topic/40299-data-isnt-being-sent-from-email-form/#findComment-194954 Share on other sites More sharing options...
ssnavely76 Posted February 27, 2007 Author Share Posted February 27, 2007 Thanks magic2goodil That works great Link to comment https://forums.phpfreaks.com/topic/40299-data-isnt-being-sent-from-email-form/#findComment-195286 Share on other sites More sharing options...
magic2goodil Posted February 28, 2007 Share Posted February 28, 2007 welcome. Link to comment https://forums.phpfreaks.com/topic/40299-data-isnt-being-sent-from-email-form/#findComment-195791 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.