Lehnhardt Posted May 16, 2008 Share Posted May 16, 2008 Hello, im trying to get a mail script to work properly. Its sending to the email but when it gets there its not displaying the information from the form... just wondering what the problem is. here is the code from the php file if any other code is needed tell me. <?php error_reporting(0); $myaddress = "rickylehnhardt@gmail.com"; // edit this to change the mail receiver $subject = "An email from your website."; // edit this to change the mails subject $feedback = "Thank you for emailing us."; // the message the user receives after emailing $message = $_POST['name']."<br>".$_POST['address']."<br>".$_POST['state']."<br>".$_POST['zip']."<br>".$_POST['country']."<br>".$_POST['email']."<br>".$_POST['phone']; mail($myaddress,$subject,$message); echo $feedback."<br><a href=\"contanct.html\">Continue</a>" ?> Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted May 16, 2008 Share Posted May 16, 2008 put above the sending <?php print_r($_POST); ?> and verify its sending the post data as u think it is Quote Link to comment Share on other sites More sharing options...
Lehnhardt Posted May 16, 2008 Author Share Posted May 16, 2008 hmm not sure if i did that right, mind you i just started on php <?php print_r($_POST); error_reporting(0); $myaddress = "rickylehnhardt@gmail.com"; // edit this to change the mail receiver $subject = "An email from your website."; // edit this to change the mails subject $feedback = "Thank you for emailing us."; // the message the user receives after emailing $message = $_POST['name']."<br>".$_POST['address']."<br>".$_POST['state']."<br>".$_POST['zip']."<br>".$_POST['country']."<br>".$_POST['email']."<br>".$_POST['phone']; mail($myaddress,$subject,$message); echo $feedback."<br><a href=\"contact2.html\">Continue</a>" ?> Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted May 16, 2008 Share Posted May 16, 2008 yup and does the print_r display anything other than array() ??? Quote Link to comment Share on other sites More sharing options...
Lehnhardt Posted May 16, 2008 Author Share Posted May 16, 2008 alright what is happening is this it displays array () on the continue page. But the email still shows the br in the tags as you can see. Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted May 16, 2008 Share Posted May 16, 2008 the PRINT_R($VAR) is by design a function to view the content of a variable. In the case of what I showed you it is giving you the content of the superglobal array $_POST which as you can see is an empty set array. Thus your problem is exactly as I thought the POST values aren't being sent to this page. Quote Link to comment Share on other sites More sharing options...
Lehnhardt Posted May 16, 2008 Author Share Posted May 16, 2008 so is it somthing to do with my html file? Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted May 16, 2008 Share Posted May 16, 2008 well do you realize how a form works? cause I don't see your form. Quote Link to comment Share on other sites More sharing options...
Lehnhardt Posted May 16, 2008 Author Share Posted May 16, 2008 Here is my form code. I have a very above average understanding of HTML but like i said im trying to learn php but this is the code for my form its hand typed so my problem might be a flaw that im not seeing <form action="sendmail3.php" method="post" enctype="text/plain"> <Table border="0" cellpadding="0" cellspacing="0" align="center" valign="top"> <tr> <td width="200" height="15"></td> <td width="20"> </td> <td width="350"></td> </tr> <tr> <td><h1>Contact Us</h1></td> <td></td> <td width="180"></td> </tr> <tr> <td align="right"><intro>Name</intro></td> <td><p> </p><p> </p></td> <td width="180"><input name="name" type="text" id="name" size="32"></td> </tr> <tr> <td align="right"><intro>Address</intro></td> <td><p> </p><p> </p></td> <td width="180"><input name="address" type="text" id="address" size="32"></td> </tr> <tr> <td align="right"><intro>City, State, ZIP</intro></td> <td><p> </p><p> </p></td> <td width="180"><input name="city" type="text" id="city" size="19"> <input name="state" type="text" id="state" size="2"> <input name="zip" type="text" id="zip" size="6"></td> </tr> <tr> <td align="right"><intro>Country</intro></td> <td><p> </p><p> </p></td> <td width="180"><input name="country" type="text" id="country" size="32"></td> </tr> <tr> <td align="right"><intro>Email Address</intro></td> <td><p> </p><p> </p></td> <td width="180"><input name="email" type="text" id="email" size="32"></td> </tr> <tr> <td align="right"><intro>Phone</intro></td> <td><p> </p><p> </p></td> <td width="180"><input name="phone" type="text" id="phone" size="32"></td> </tr> </table> <!---------------------END BLUE GRADIENT------------------------> </td> </tr> <tr> <td width="40"></td> <td> <Table border="0" cellpadding="0" cellspacing="0" align="center" valign="top"> <tr> <td> <input type="submit" value="send"> <input type="reset" value="clear"> </td> </tr> </table> </form> Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted May 16, 2008 Share Posted May 16, 2008 <form action="sendmail3.php" method="post" enctype="text/plain"> Look at your browser where its pointing in the picture you gave me. The form's gotta process to the location you want the processing to occur on because post dies onload basically. Quote Link to comment Share on other sites More sharing options...
Lehnhardt Posted May 16, 2008 Author Share Posted May 16, 2008 D: im sorry its a bit late, well early for me iv been up for a while. You have to talk in smaller words lol Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted May 16, 2008 Share Posted May 16, 2008 sendmail3.php does not equal mail2.php as you showed in your pic Quote Link to comment Share on other sites More sharing options...
Lehnhardt Posted May 16, 2008 Author Share Posted May 16, 2008 woah ok ya sorry about that i had to read it a few times before i noticed. I opened the wrong version for the code i sent :S again its really late. here is teh correct code <form action="mail2.php" method="post" enctype="text/plain"> <Table border="0" cellpadding="0" cellspacing="0" align="center" valign="top"> <tr> <td width="200" height="15"></td> <td width="20"> </td> <td width="350"></td> </tr> <tr> <td><h1>Contact Us</h1></td> <td></td> <td width="180"></td> </tr> <tr> <td align="right"><intro>Name</intro></td> <td><p> </p><p> </p></td> <td width="180"><input name="name" type="text" id="name" size="32"></td> </tr> <tr> <td align="right"><intro>Address</intro></td> <td><p> </p><p> </p></td> <td width="180"><input name="address" type="text" id="address" size="32"></td> </tr> <tr> <td align="right"><intro>City, State, ZIP</intro></td> <td><p> </p><p> </p></td> <td width="180"><input name="city" type="text" id="city" size="19"> <input name="state" type="text" id="state" size="2"> <input name="zip" type="text" id="zip" size="6"></td> </tr> <tr> <td align="right"><intro>Country</intro></td> <td><p> </p><p> </p></td> <td width="180"><input name="country" type="text" id="country" size="32"></td> </tr> <tr> <td align="right"><intro>Email Address</intro></td> <td><p> </p><p> </p></td> <td width="180"><input name="email" type="text" id="email" size="32"></td> </tr> <tr> <td align="right"><intro>Phone</intro></td> <td><p> </p><p> </p></td> <td width="180"><input name="phone" type="text" id="phone" size="32"></td> </tr> </table> <!---------------------END BLUE GRADIENT------------------------> </td> </tr> <tr> <td width="40"></td> <td> <Table border="0" cellpadding="0" cellspacing="0" align="center" valign="top"> <tr> <td> <input type="submit"> <input type="reset" value="clear"> </td> </tr> </table> </form> Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted May 16, 2008 Share Posted May 16, 2008 well if you are "processing" the form properly the issue I can see is that enctype="text/plain" which isn't needed and might be causing problems Quote Link to comment Share on other sites More sharing options...
Lehnhardt Posted May 16, 2008 Author Share Posted May 16, 2008 :'( <---- tear of happiness Thank you so much, not really sure what that code was doing in there i dont remember typing it D: weird.... Anyways you were very helpfull thanks ... one more quick question you see how i got the <br> code in there well why wont it display them on different lines like a hard enter should Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted May 16, 2008 Share Posted May 16, 2008 your email lacks the sufficient headers for the email client to render it as a html message. Thus the client renders it a a plain/text message as a default protocol and thus the <br> are either ignored or rendered out as text. To get around this you need to declare proper html mail headers which I will let you do some research on because you are missing a lot of headers that help improve the delivery success of your message such as the php version and sender data etc. Quote Link to comment Share on other sites More sharing options...
Lehnhardt Posted May 16, 2008 Author Share Posted May 16, 2008 thanks, i guess learning on my own will be beneficial thanks again. You've been a big help Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.