Sending Current Page As Email
Posted: Sun Nov 20, 2011 4:27 am
Hi All, I have a page that comes up as a result of a form, they are results of an order page.
I would like the whole page as it shows to be sent as an email. I need help with this plz..
foodorder.php
revieworder.php
sendorder.php
I would like the whole page as it shows to be sent as an email. I need help with this plz..
foodorder.php
Code: Select all
<?php
// Script Error Reporting
error_reporting(E_ALL);
ini_set('display_errors', '1');
?>
<?php
include "storescripts/connect_to_mysql.php";
$sql = "SELECT id, product_code, description, units_per_product, unit_price, product_price, points, subcategory FROM food ORDER BY id ASC";
$products = mysql_query($sql);
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Debug</title>
</head>
<body>
<?php if (isset($products) && $products !== FALSE): ?>
<form id="frmPurchase" action="review_order.php" method="post">
<?php while ($row = mysql_fetch_assoc($products)): ?>
<body topmargin="0" leftmargin="0">
<div align="center">
<table cellpadding="0" cellspacing="0" border="0" bordercolor="#C0C0C0" width="793" height="25">
<!-- MSTableType="layout" -->
<tr>
<td valign="middle" width="74" style="border-left-style: solid; border-left-width: 1px; border-top-style: solid; border-top-width: 1px; border-bottom-style: solid; border-bottom-width: 1px; border-right-style:none; border-right-width:medium">
<font face="Verdana" size="1"> <?php echo $row['product_code']; ?></font></td>
<td valign="middle" width="310" style="border-left-style: none; border-left-width: medium; border-top-style: solid; border-top-width: 1px; border-bottom-style: solid; border-bottom-width: 1px; border-right-style:none; border-right-width:medium">
<font face="Verdana" size="2"><?php echo $row['description']; ?></font></td>
<td valign="middle" width="92" style="border-left-style: none; border-left-width: medium; border-top-style: solid; border-top-width: 1px; border-bottom-style: solid; border-bottom-width: 1px; border-right-style:none; border-right-width:medium">
<p align="center"><font face="Verdana" style="font-size: 8.5pt"><?php echo $row['units_per_product']; ?></font></td>
<td valign="middle" width="79" style="border-left-style:none; border-left-width:medium; border-right-style:none; border-right-width:medium; border-top-style:solid; border-top-width:1px; border-bottom-style:solid; border-bottom-width:1px">
<p align="left"><font face="Verdana" style="font-size: 8.5pt"> $<?php echo $row['unit_price']; ?> </font></td>
<td valign="middle" width="93" style="border-top-style: solid; border-top-width: 1px; border-bottom-style: solid; border-bottom-width: 1px; border-left-style:none; border-left-width:medium; border-right-style:none; border-right-width:medium">
<p align="left"><font face="Verdana" style="font-size: 8.5pt"> $<?php echo $row['product_price']; ?></font></td>
<td width="56" style="border-left-style:none; border-left-width:medium; border-right-style:none; border-right-width:medium; border-top-style:solid; border-top-width:1px; border-bottom-style:solid; border-bottom-width:1px" valign="middle">
<p align="right"> <font face="Verdana" size="1">Qty: </font></td>
<td height="25" width="87" style="border-left-style: none; border-left-width: medium; border-right-style: solid; border-right-width: 1px; border-top-style: solid; border-top-width: 1px; border-bottom-style: solid; border-bottom-width: 1px">
<p align="center">
<input type="text" name="<?php echo "{$row['id']}|{$row['product_code']}|{$row['description']}|{$row['units_per_product']}|{$row['product_price']}|{$row['unit_price']}|{$row['points']}|{$row['subcategory']}"; ?>" size="1" />
</p> </td>
</tr>
</table>
<body/>
<table cellpadding="0" cellspacing="0" width="779" height="3">
<!-- MSTableType="layout" -->
<tr>
<td width="779" height="3"></td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" width="779" height="19">
<!-- MSTableType="layout" -->
<tr>
<td width="779" height="19" valign="top">
<table/>
<div/>
<body/>
<?php endwhile; ?>
<tr>
<td>
<input type="submit" value="Place Order" />
<input type="reset" value="Reset" />
</td>
</tr>
</form>
<div align="center">
<?php endif; ?> </body>
</td>
</tr>
</table>
</div>
</body>
</html>
revieworder.php
Code: Select all
<?php
// Script Error Reporting
error_reporting(E_ALL);
ini_set('display_errors', '1');
?>
<?php include_once("template_header.html");?>
<div align="center">
<table cellpadding="0" cellspacing="0" border="0" bordercolor="#333333" width="768" height="43" style="border-left-width: 0px; border-top-width: 0px; border-bottom-width: 0px">
<!-- MSTableType="layout" -->
<tr>
<td valign="middle" width="768" style="border-style:none; border-width:medium; " align="center">
<p align="left">
<font face="Verdana" color="#CC0000" style="font-size: 11pt; font-style: italic">
<br>
Review Your Order<br>
</font></td>
</tr>
</table>
</div>
<body>
<div align="center">
<table cellpadding="0" cellspacing="0" border="0" bordercolor="#333333" width="768" height="43" style="border-left-width: 0px; border-top-width: 0px; border-bottom-width: 0px">
<!-- MSTableType="layout" -->
<tr>
<td valign="middle" width="69" style="border-style:none; border-width:medium; " align="center">
<p align="left"><b><font face="Meiryo" size="1"> Code</font></b></td>
<td align="center" width="238"><p align="left"><b><font face="Meiryo" size="1">Product Description</font></b></td>
<td align="center" width="66"><b><font face="Meiryo" size="1">Units Per<br>Product</font></b></td>
<td align="center" width="71"><b><font face="Meiryo" size="1">Unit Price</font></b></td>
<td align="center" width="92"><b><font face="Meiryo" size="1">Product Price</font></b></td>
<td align="center" width="77"><b><font face="Meiryo" size="1">Qty<br>Required</font></b></td>
<td align="center" width="85"><b><font face="Meiryo" size="1">Totals</font></b></td>
<td align="center" height="43" width="70"><b><font face="Meiryo" size="1" color="#CC0000">Rewards<br>
Points</font></b></td>
</tr>
</table>
</div>
</body>
<?php
include "storescripts/connect_to_mysql.php";
// If the form has been posted, process it.
if (!empty($_POST))
{
foreach ($_POST as $k => $v)
{
if ($v > 0)
{
// This is pretty messy, but it prevents having to query the database again
$details = explode('|', $k);
$qty = "{$v}";
$id = "{$details[0]}";
$product_code = "{$details[1]}";
$description = "{$details[2]}";
$units_per_product = "{$details[3]}";
$product_price = "{$details[4]}";
$unit_price = "{$details[5]}";
$points = "{$details[6]}";
$subcategory = "{$details[7]}";
$totals = $product_price * $qty;
$totalpoints = $points * $qty;
echo '
<body>
<div align="center">
<table cellpadding="0" cellspacing="0" border="0" bordercolor="#333333" width="768" height="19" style="border-left-width: 0px; border-top-width: 0px; border-bottom-width: 0px">
<!-- MSTableType="nolayout" -->
<tr>
<td valign="middle" width="69" style="border-style:none; border-width:medium; " align="center">
<p align="left"><font face="Meiryo" size="1">' .$product_code. '</font></td>
<td align="center" width="238">
<p align="left"><font face="Meiryo" size="1">' .$description. '</font></td>
<td align="center" width="66"><font face="Meiryo" size="1">' .$units_per_product. '</font></td>
<td align="center" width="71"><font face="Meiryo" size="1">$' .$unit_price. '</font></td>
<td align="center" width="92"><font face="Meiryo" size="1">$' .$product_price. '</font></td>
<td align="center" width="77"><font face="Meiryo" size="1">' .$qty. '</font></td>
<td align="center" width="85"><font face="Meiryo" size="1">$' .$totals. '</font></td>
<td align="center" height="19" width="70">
<font face="Meiryo" size="1" color="#CC0000">' .$totalpoints. '</font></td>
</tr>
</table>
</div>
</body>
</html>';
}
}
}
?>
</br>
<form action="sendorder.php">
<input type="hidden" name="mail" value="" />
<input type="submit" value="Confirm Order" />
</form>
<?php include_once("template_footer.html");?>Code: Select all
<?php
$clubname = "testclubname";
$email = "testemail";
$mail = " WHAT DO I PUT HERE ???? "
if (isset ($_POST ['mail']));{
// To, Subject, Message, Header
mail('ronni@promotingu.com.au', 'Food Order', '' .$mail. '', 'FROM: ' .$clubname. ' <' .$email. '>');
}
echo 'Your Order Has Been Submitted To Admin, Will Will Contact You Withing The Next Few Days';
exit();
?>