Jump to content

Php Form mail showing up in html code and not readable- help?


CowgirlArt

Recommended Posts

Hello.  I'm trying to format a form to arrive via email.  The form works but it sends the code in html code and does not show up in the table that it should.  I have no idea what I'm doing (can't help but be honest).  I really could use some help until my pHp class starts this semester.


Here's how it reads when it comes through via email to me:

""<table border="1"><tr><td> Order Submission</td></tr>
<tr><th>Name</th>
<th>Address</th>
<th>City</th>
<th>Phone</th>
<th>E-mail</th>
<th>Show Location</th>
<th>Show Date</th>
</tr>
<tr><td>  </td>
<td>  </td>
<td>    </td>
<td> </td>
<td> szukteam@yahoo.com</td>
<td></td>
<td>  </td>
</tr></table>

<table border="1"><tr><td> Photo Selections </td></tr>
<tr>
<th>First Selection</th>
<th>Second Selection</th>
<th>Third Selection</th>
<th>Fourth Selection</th>
<th>Fifth Selection</th>
</tr>
<tr>
<td>    </td>
<td>    </td>
<td>    </td>
<td>    </td>
<td>    </td>
</tr>
</table>

<table border="1"><tr><td> Special Instructions </td></tr>
<tr>
<td> </td>
</tr>
</table>
</html>""

[color=green]This is what the php page looks like:[/color]


""<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Thank You for Your Show Pic Order</title>
<style type="text/css">
<!--
body {
background-color: #000000;
}
body,td,th {
color: #FFFFFF;
}
-->
</style>
<link href="../styles/styles.css" rel="stylesheet" type="text/css" />
</head>

<body>
<p><img src="../images/template_page_r1_c1.jpg" alt="logo" width="800" height="298" /></p>
<h1>Thank you for placing your order</h1>

<span class="style1">The following is a confirmation of the information you have provided:
</span>
<p>&nbsp;</p>
<table width="782" border="0" id="cstomerid" summary="Summary of order form for Puhl Photography">
  <tr>
    <td width="236"><div align="right">First Name: </div></td>
    <td colspan="5"><?php echo $HTTP_POST_VARS['first_name']; ?></td>
  </tr>
  <tr>
    <td><div align="right">Last Name: </div></td>
    <td colspan="5"><?php echo $HTTP_POST_VARS['last_name']; ?></td>
  </tr>
  <tr>
    <td><div align="right">Mailing Address: </div></td>
    <td colspan="5"><?php echo $HTTP_POST_VARS['mailing_address']; ?></td>
  </tr>
  <tr>
    <td><div align="right">2nd Line Mailing Address (if needed):</div></td>
    <td colspan="5"><?php echo $HTTP_POST_VARS['2nd_line_address']; ?></td>
  </tr>
  <tr>
    <td width="236"><div align="right">City:</div></td>
    <td width="174"><?php echo $HTTP_POST_VARS['city']; ?></td>
    <td width="60"><div align="right">State:</div></td>
    <td width="75"><?php echo $HTTP_POST_VARS['state']; ?></td>
    <td width="64"><div align="right">Zip Code:</div></td>
    <td width="133"><?php echo $HTTP_POST_VARS['zipcode']; ?></td>
  </tr>
  <tr>
    <td><div align="right">Phone Number - </div></td>
    <td colspan="5"><?php echo $HTTP_POST_VARS['phone_number']; ?></td>
  </tr>
  <tr>
    <td><div align="right">Email Address - </div></td>
    <td colspan="5"><?php echo $HTTP_POST_VARS['email']; ?></td>
  </tr>
  <tr>
    <td><div align="right">Show Location- </div></td>
    <td colspan="5"><?php echo $HTTP_POST_VARS['show_location']; ?></td>
  </tr>
  <tr>
    <td><div align="right">Show Month - </div></td>
    <td colspan="5"><?php echo $HTTP_POST_VARS['month']; ?></td>
  </tr>
<tr>
<td><div align="right">Show Date - </div></td>
<td colspan="5"><?php echo $HTTP_POST_VARS['date']; ?></td>
</tr>
</table>
<p>&nbsp;</p>
<table width="782" border="1" id="photorder" summary="Order information">
  <tr>
    <td width="286"><p>1st Photo Image No :<?php echo $HTTP_POST_VARS['1st_image_number']; ?></p>
    </td>
    <td width="170" valign="top"> Event
      :<br />
    <?php echo $HTTP_POST_VARS['1st_photo_class']; ?></td>
    <td width="312">Photo Size: <br /><?php echo $HTTP_POST_VARS['1st_photo_size']; ?></td></tr>
    <tr><td><p>2nd Photo Image No. :<?php echo $HTTP_POST_VARS['2nd_image_number']; ?></p>
    </td>
    <td> Event: <br /><?php echo $HTTP_POST_VARS['2nd_photo_class']; ?></td>
    <td>Photo Size<br />
    <?php echo $HTTP_POST_VARS['2nd_photo_size']; ?></td>
  </tr>
  <tr>
    <td><p>3rd Photo Image No. : <?php echo $HTTP_POST_VARS['3rd_image_number']; ?></p>
    </td>
    <td>Class/Category of Event:<br />
    <?php echo $HTTP_POST_VARS['3rd_photo_class']; ?></td>
    <td>Photo Size<br /><?php echo $HTTP_POST_VARS['3rd_photo_size']; ?></td>
  </tr>
  <tr>
    <td><p>4th Photo Image No. : <?php echo $HTTP_POST_VARS['4th_image_number']; ?></p>
    </td>
    <td>Class/Category of Event: <br />
    <?php echo $HTTP_POST_VARS['4th_photo_class']; ?></td>
    <td>Photo Size<br /><?php echo $HTTP_POST_VARS['4th_photo_size']; ?></td>
  </tr>
  <tr>
    <td>5th Photo Image No. : <?php echo $HTTP_POST_VARS['5th_image_number']; ?></td>
    <td>Class/Category of Event:<br />
    <?php echo $HTTP_POST_VARS['5th_photo_class']; ?></td>
    <td>Photo Size<br /><?php echo $HTTP_POST_VARS['5th_photo_size']; ?></td>
  </tr>
<tr>
<td colspan="3"> Special Instructions: <?php echo $HTTP_POST_VARS['special_instructions']; ?></td>
</tr>
</table>
<p>&nbsp;</p>
<?php
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html: charset=iso-8859-1' . "\r\n";

$content="
<table border=\"1\"><tr><td> Order Submission</td></tr>
<tr><th>Name</th>
<th>Address</th>
<th>City</th>
<th>Phone</th>
<th>E-mail</th>
<th>Show Location</th>
<th>Show Date</th>
</tr>
<tr><td> ". $_POST['first_name'] . "  ". $_POST['last_name'] . "</td>
<td>". $_POST['mailing_address'] ."  ". $_POST['2nd_line_address'] . "</td>
<td>". $_POST['city'] ."  ". $_POST['state'] . "  ". $_POST['zipcode'] . "</td>
<td> ". $_POST['phone_number'] . "</td>
<td> ". $_POST['email'] ."</td>
<td>". $_POST['show_location'] ."</td>
<td>". $_POST['month'] ."  ". $_POST['date'] . "</td>
</tr></table>

<table border=\"1\"><tr><td> Photo Selections </td></tr>
<tr>
<th>First Selection</th>
<th>Second Selection</th>
<th>Third Selection</th>
<th>Fourth Selection</th>
<th>Fifth Selection</th>
</tr>
<tr>
<td> ". $_POST['1st_image_number'] . "  ". $_POST['1st_photo_class'] . "  ". $_POST['1st_photo_size'] . "</td>
<td> ". $_POST['2nd_image_number'] . "  ". $_POST['2nd_photo_class'] . "  ". $_POST['2nd_photo_size'] . "</td>
<td> ". $_POST['3rd_image_number'] . "  ". $_POST['3rd_photo_class'] . "  ". $_POST['3rd_photo_size'] . "</td>
<td> ". $_POST['4th_image_number'] . "  ". $_POST['4th_photo_class'] . "  ". $_POST['4th_photo_size'] . "</td>
<td> ". $_POST['5th_image_number'] . "  ". $_POST['5th_photo_class'] . "  ". $_POST['5th_photo_size'] . "</td>
</tr>
</table>

<table border=\"1\"><tr><td> Special Instructions </td></tr>
<tr>
<td> ". $_POST['special_instructions'] ."</td>
</tr>
</table>
</html>";

//send
mail('info@sitesbykate.com', 'testing formmail', $content);
?>

</body>
</html>
""
Link to comment
Share on other sites

Read just this part:
[code]
$content="
<table border=\"1\"><tr><td> Order Submission</td></tr>
<tr><th>Name</th>
<th>Address</th>
<th>City</th>
<th>Phone</th>
<th>E-mail</th>
<th>Show Location</th>
<th>Show Date</th>
</tr>
<tr><td> ". $_POST['first_name'] . "  ". $_POST['last_name'] . "</td>
<td>". $_POST['mailing_address'] ."  ". $_POST['2nd_line_address'] . "</td>
<td>". $_POST['city'] ."  ". $_POST['state'] . "  ". $_POST['zipcode'] . "</td>
<td> ". $_POST['phone_number'] . "</td>
<td> ". $_POST['email'] ."</td>
<td>". $_POST['show_location'] ."</td>
<td>". $_POST['month'] ."  ". $_POST['date'] . "</td>
</tr></table>

<table border=\"1\"><tr><td> Photo Selections </td></tr>
<tr>
<th>First Selection</th>
<th>Second Selection</th>
<th>Third Selection</th>
<th>Fourth Selection</th>
<th>Fifth Selection</th>
</tr>
<tr>
<td> ". $_POST['1st_image_number'] . "  ". $_POST['1st_photo_class'] . "  ". $_POST['1st_photo_size'] . "</td>
<td> ". $_POST['2nd_image_number'] . "  ". $_POST['2nd_photo_class'] . "  ". $_POST['2nd_photo_size'] . "</td>
<td> ". $_POST['3rd_image_number'] . "  ". $_POST['3rd_photo_class'] . "  ". $_POST['3rd_photo_size'] . "</td>
<td> ". $_POST['4th_image_number'] . "  ". $_POST['4th_photo_class'] . "  ". $_POST['4th_photo_size'] . "</td>
<td> ". $_POST['5th_image_number'] . "  ". $_POST['5th_photo_class'] . "  ". $_POST['5th_photo_size'] . "</td>
</tr>
</table>

<table border=\"1\"><tr><td> Special Instructions </td></tr>
<tr>
<td> ". $_POST['special_instructions'] ."</td>
</tr>
</table>
</html>";

//send
mail('info@sitesbykate.com', 'testing formmail', $content);
?>[/code]

And you should be able to tell why it's only sending that.  ;)
Link to comment
Share on other sites

You give me more credit than I deserve  :D
I've looked at this for a week now. And I've put it away and come back.

I know NOTHING about php, I've tried to "frankenstein" it from forms that I know work until I can learn this stuff.

Please...a bigger hint? Or for kicks...tell me what I did? 

THank you!  :-*
Link to comment
Share on other sites

Yep, that's what I was pointing out.

After doing some reading, I think this will do what you want:
[code]
<?php
$content="
<html><body><table border=\"1\"><tr><td> Order Submission</td></tr>
<tr><th>Name</th>
<th>Address</th>
<th>City</th>
<th>Phone</th>
<th>E-mail</th>
<th>Show Location</th>
<th>Show Date</th>
</tr>
<tr><td> ". $_POST['first_name'] . "  ". $_POST['last_name'] . "</td>
<td>". $_POST['mailing_address'] ."  ". $_POST['2nd_line_address'] . "</td>
<td>". $_POST['city'] ."  ". $_POST['state'] . "  ". $_POST['zipcode'] . "</td>
<td> ". $_POST['phone_number'] . "</td>
<td> ". $_POST['email'] ."</td>
<td>". $_POST['show_location'] ."</td>
<td>". $_POST['month'] ."  ". $_POST['date'] . "</td>
</tr></table>

<table border=\"1\"><tr><td> Photo Selections </td></tr>
<tr>
<th>First Selection</th>
<th>Second Selection</th>
<th>Third Selection</th>
<th>Fourth Selection</th>
<th>Fifth Selection</th>
</tr>
<tr>
<td> ". $_POST['1st_image_number'] . "  ". $_POST['1st_photo_class'] . "  ". $_POST['1st_photo_size'] . "</td>
<td> ". $_POST['2nd_image_number'] . "  ". $_POST['2nd_photo_class'] . "  ". $_POST['2nd_photo_size'] . "</td>
<td> ". $_POST['3rd_image_number'] . "  ". $_POST['3rd_photo_class'] . "  ". $_POST['3rd_photo_size'] . "</td>
<td> ". $_POST['4th_image_number'] . "  ". $_POST['4th_photo_class'] . "  ". $_POST['4th_photo_size'] . "</td>
<td> ". $_POST['5th_image_number'] . "  ". $_POST['5th_photo_class'] . "  ". $_POST['5th_photo_size'] . "</td>
</tr>
</table>

<table border=\"1\"><tr><td> Special Instructions </td></tr>
<tr>
<td> ". $_POST['special_instructions'] ."</td>
</tr>
</table>
</body>
</html>";
mail('info@sitesbykate.com', 'testing formmail', $content,
    "To: Kate <info@sitesbykate.com>\n" .
    "From: The Sender <sender@some.net>\n" .
    "MIME-Version: 1.0\n" .
    "Content-type: text/html; charset=iso-8859-1");
?>
[/code]


For more information:
http://www.sitepoint.com/article/advanced-email-php
Link to comment
Share on other sites

Thank you, I'll try this.  I did insert the head, body, etc in what I'd done originally.  It still came through the same way- only showed what I added. It's great for someone who reads html-- sucks otherwise.

I'll see if I can get this to work. 
I appreciate it.
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.