nyjet88 Posted March 25, 2008 Share Posted March 25, 2008 Here is the form code: <form name="formcheck" method="post" action="sendmail.php" onsubmit="return formCheck(this);"> <table width="414" height="289" border="0"> <tr> <td width="164" height="31"><div align="right" class="style5">Name:</div></td> <td width="10"> </td> <td width="228"><label> <input name="name" type="text" id="name" size="30"> </label></td> </tr> <tr> <td height="31"><div align="right" class="style5">Company:</div></td> <td> </td> <td><label> <input name="company" type="text" id="company" size="30"> </label></td> </tr> <tr> <td height="35"><div align="right" class="style5">E-Mail Address:</div></td> <td> </td> <td><label> <input name="email" type="text" id="email" size="30"> </label></td> </tr> <tr> <td valign="top"><div align="right" class="style5">Question/Comments:<br> <span class="style8">(Limit 300 Characters) </span></div></td> <td valign="top"> </td> <td><label> <textarea name="comments" cols="30" rows="10" wrap="physical" id="comments"></textarea> </label></td> </tr> <tr> <td valign="top"><label></label></td> <td valign="top"> </td> <td><label></label> <input type="submit" name="submit" id="submit" value="Submit"></td> </tr> </table> </form> Here is the PHP code: <?php $name = $_REQUEST['name'] ; $company = $_REQUEST['company'] ; $email = $_REQUEST['email'] ; $comments = $_REQUEST['comments'] ; mail( "[email protected]", "Info Request from www.systek.com", $comments, "From: $email" ); header( "Location: http://www.systek.com/NEW/thankyou.html" ); ?> How can I get the php file to display the $name, $company, $email, $comments in the email? I thought maybe I needed to do $name, $company, $email, $comments, "From: $email" ); but that did not work...it actually didn't even process at that point. Any help is GREATLY appreciated. Thanks in advance, John Link to comment https://forums.phpfreaks.com/topic/97837-form-mail-not-all-contents-are-going-into-my-email/ Share on other sites More sharing options...
discomatt Posted March 25, 2008 Share Posted March 25, 2008 A couple things to note before we get to the initial issue. Your code is open to injection attacks, and I'd suggest fixing this before worrying about functionality. 1. Header injection. You should sanitize all input... at the very least remove any line breaks from the user input. Read more: http://www.securephpwiki.com/index.php/Email_Injection 2. Content injection. You should sanitize the body of the email with htmlentities() Link to comment https://forums.phpfreaks.com/topic/97837-form-mail-not-all-contents-are-going-into-my-email/#findComment-500550 Share on other sites More sharing options...
nyjet88 Posted March 25, 2008 Author Share Posted March 25, 2008 Thank you. I will do my best. I am new to PHP and just wanted to setup a form and ran a tutorial. Link to comment https://forums.phpfreaks.com/topic/97837-form-mail-not-all-contents-are-going-into-my-email/#findComment-500553 Share on other sites More sharing options...
discomatt Posted March 25, 2008 Share Posted March 25, 2008 Well, start walking before you start to run. Last thing you want is a bot abusing your script to send Nigerian spam I'd suggest using a known mailer class if all of this is still over your head. Swiftmailer is a good one, and can be found here: http://www.swiftmailer.org/ No sense in reinventing the wheel Link to comment https://forums.phpfreaks.com/topic/97837-form-mail-not-all-contents-are-going-into-my-email/#findComment-500563 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.