laflair13 Posted March 4, 2006 Share Posted March 4, 2006 I am putting together a website for the mother and her business. She wants a contact form so customers can contect her, instead of using an email.I got some coding together but when I submit it the email comes in blank. Can any of ya help me out on this one.Heres a look at the codes.[code]<html><head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><br><br><form method="post" action="sendmail.php"> Email: <input name="email" type="text" /><br /> Name:<input type="text" name="name" size="20"><br /> <br /> <input type="submit" /></form></body></html>[/code]&[code]<? $email = $_REQUEST['email']; $name = $_REQUEST['name']; mail( "[email protected]", "Link Request", $message, "From: $email" ); header( "Location: <a href="http://www.example.com/thankyou.html" target="_blank">http://www.example.com/thankyou.html</a>" );?>[/code]There is only 2 feilds because I wanted to test it first before adding any more options. Like url, how they found her site (refered, search engine, blah, blah) which will be a drop down box.Any help would be greatly appreciated. Link to comment https://forums.phpfreaks.com/topic/4059-submit-form-problem/ Share on other sites More sharing options...
kenrbnsn Posted March 4, 2006 Share Posted March 4, 2006 Well, since you're not putting any text in the variable $message, you're sending anything so you will get a blank message.Change your form to include a message box:[code]html><head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><br><br><form method="post" action="sendmail.php"> Email: <input name="email" type="text" /><br /> Name:<input type="text" name="name" size="20"><br /> Message: <textarea name="message" colums="50" rows="10"></textarea> <br /> <input type="submit" name="submit" value="Send Message"/></form></body></html>[/code]And in the processing script:[code]<?php $email = $_POST['email']; $name = $_POST['name']; $message = stripslashes($_POST['message']); mail( "[email protected]", "Link Request", $message, "From: $email" ); header( "Location: http://www.example.com/thankyou.html");?>[/code]Note: the header() function is not a address tag, so it doesn't take any of the <a> options.Ken Link to comment https://forums.phpfreaks.com/topic/4059-submit-form-problem/#findComment-14077 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.