Jump to content

Help with mail script


Lehnhardt

Recommended Posts

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>"
?>

 

 

Link to comment
Share on other sites

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>"
?>

 

 

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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>

 

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

:'(  <---- 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 :D

 

... 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

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.