svenny1 Posted June 30, 2008 Share Posted June 30, 2008 Hi i have followed a tutorial, and my e-mail form works fine, just i want to add more input boxes (which i can do) and then display them in the message of the e-mail. It is a form so a person can register with a clan for a gaming site. Html Code - join.html <form method="post" action="contact.php"> PSI: <input name="psi" type="text"><br> E-Mail: <input name="email" type="text"><br> Message:<br> <textarea name="message" rows="15" cols="40"></textarea><br> <input type="submit"> </form> PHP Code - contact.php <?php $to = "[email protected]"; $subject = "$psi wants to Join"; $psi = $_REQUEST['psi'] ; $email = $_REQUEST['email'] ; $message = $_REQUEST['message']; $headers = "From: $email"; $sent = mail($to, $subject, $message, $headers) ; if($sent) {print "$psi your application was sent successfully"; } else {print "Sorry $psi We encountered an error sending your mail"; } ?> Basically i want the submitted form to print the email, psi number and the message into the message on the actual e-mail. So the e-mail will pop up and say the following; PSI number: 5768932 E-mail Address: [email protected] Message: Hi i want to join your clan. So my problem is i can't seem to get more than just the message to appear in the actual e-mail. Many thanks in advance! Link to comment https://forums.phpfreaks.com/topic/112580-solved-simple-e-mail-form-question/ Share on other sites More sharing options...
interpim Posted June 30, 2008 Share Posted June 30, 2008 $var = "Text you want to add to your email. it gets formatted how you type it in your code."; $message = $message . $var; Link to comment https://forums.phpfreaks.com/topic/112580-solved-simple-e-mail-form-question/#findComment-578255 Share on other sites More sharing options...
br0ken Posted June 30, 2008 Share Posted June 30, 2008 Also, you need some form of validation on your user input because right now your form is wide open for injection. <?php $psi = addslashes(strip_tags($_REQUEST['psi'])); $email = addslashes(strip_tags($_REQUEST['email'])); $message = addslashes(strip_tags($_REQUEST['message'])); ?> Link to comment https://forums.phpfreaks.com/topic/112580-solved-simple-e-mail-form-question/#findComment-578291 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.