ewwatson Posted March 31, 2008 Share Posted March 31, 2008 I'm so close I can taste it! The form gets submitted and emailed to me. The only problem is the email that I get is empty - but at least I get it! So what am I missing - hopefully something little. Here is the form and the php code. Thanks! <form method="post" action="formmail.php"> <label for="name">Name</label> <input id="name" name="name" class="iehover"> <br> <label for="email">Email</label> <input id="email" name="email" class="iehover"> <br> <label for="subject">Subject</label> <input id="subject" name="subject" class="iehover"> <br> <label for="comments">Comments</label> <textarea id="comments" name="comments" class="iehover"></textarea> <br> <input type="submit" name="submit" value="Submit" class="submit iesubmithover"> </form> <?php $name = $_REQUEST['name'] ; $email = $_REQUEST['email'] ; $subject = $_REQUEST['subject'] ; $comments = $_REQUEST['comments'] ; mail( "[email protected]", "Feedback Form Results", $message, "From: $email" ); header( "Location: http://www.littleaboutalot.com/thankyou.php" ); ?> EDIT - I do get the email in the subject line - or their name from the email I mean. But nothing else. Link to comment https://forums.phpfreaks.com/topic/98742-so-close-to-getting-this-php-formmail-script-to-work/ Share on other sites More sharing options...
maxudaskin Posted March 31, 2008 Share Posted March 31, 2008 Try changing <?php mail( "[email protected]", "Feedback Form Results", $message, "From: $email" ); ?> to <?php mail( "[email protected]", "Feedback Form Results", $comments, "From: $email" ); ?> $message to $comments Link to comment https://forums.phpfreaks.com/topic/98742-so-close-to-getting-this-php-formmail-script-to-work/#findComment-505294 Share on other sites More sharing options...
ewwatson Posted March 31, 2008 Author Share Posted March 31, 2008 Thanks bro - as you can see I'm somewhat lost with this. OK now I receive the email and the comments. So I am just missing the subject and the name. Here is what we are working with now. It would seem logical to me to just add $subject, $name before $comments. But when I do I no longer get the thank you page or the email - just an error message. Were on the right track though! <?php $name = $_REQUEST['name'] ; $email = $_REQUEST['email'] ; $subject = $_REQUEST['subject'] ; $comments = $_REQUEST['comments'] ; mail( "[email protected]", "LITTLEABOUTALOT.com Contact Form", $comments, "From: $email" ); header( "Location: http://www.littleaboutalot.com/thankyou.php" ); ?> Link to comment https://forums.phpfreaks.com/topic/98742-so-close-to-getting-this-php-formmail-script-to-work/#findComment-505528 Share on other sites More sharing options...
ewwatson Posted April 1, 2008 Author Share Posted April 1, 2008 Hello, OK - heres my question. Here is my very simple but working php form script. <?php $name = $_POST['name'] ; $email = $_POST['email'] ; $subject = $_POST['subject'] ; $comments = $_POST['comments'] ; mail( "[email protected]", "mydomain.com Formmail", "Name: $name \n\nSubject: $subject \n\nComments: $comments","From: $email" ); header( "Location: http://www.mydomain.com/thankyou.php" ); ?> It outputs this. Name: Eric Subject: Diabetes Comments: So Happy!! It took my a while to get this working so I am quite happy with it. However, I'm sure it's obvious to all of you all that I need to add some security and validation code to it. As I am completely new to php I was wondering if someone would be so kind to help me out. Thanks, take care! By the way it does not need to be anything fancy - just simple and easy for me to understand. Link to comment https://forums.phpfreaks.com/topic/98742-so-close-to-getting-this-php-formmail-script-to-work/#findComment-506446 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.