I have a question about carrying an entire html table from one page to another in a PHP variable.
I would have thought that I could do it, but it doesn't seem to want to work
It is a shopping cart displayed in a table, and when they accept the cart, I want to carry it to the next page to be used in the body of an email that will be sent out. I know I could rebuild it for the email, but why do it twice if there is a way to reuse the first build.
Here is what I have:
$cart_display="
<table align='center' width='900' border='1' bordercolor='#000066' cellpadding='3' cellspacing='0'>
<tr>
<td align='left' width='20%'> </td>
<td align='center' colspan='3'><h3 class='B'><font color='#3366FF'>Dealer Product Purchase Order</font></h3></td>
<td align='right' width='20%' class='bold12'>Order ID<br>".$del_id."_".$cart_id."</td>
</tr>
<tr>
<td align='left' colspan='2' class='bold12'>BILL TO : <br><br>".$bill_to_block."</td>
<td align='left' colspan='3' class='bold12'>SHIP TO : ";
if ($deliver_to=='C'){
$cart_display.="Customer";
}elseif ($deliver_to=='I'){
$cart_display.="Installer";
}else{
$cart_display.="Dealer";
}
$cart_display.="
<br><br>".$ship_to_block."</td>
</tr>
<tr>
<td align='center' width='20%'>Product ID</td>
<td align='center' width='30%'>Product Name</td>
<td align='center' width='15%'>Price</td>
<td align='center' width='15%'>Quantity</td>
<td align='right' width='20%'>Line Total</td>
</tr>
";
$sql = "
SELECT item_id, product_id, qty, price_each
FROM product_item
WHERE cart_id='$cart_id'
AND status='A'
ORDER BY prod_type desc
";
$result=mysql_query($sql);
// iterate through each record for any special processing required
while($cart_item=mysql_fetch_array($result)){
// secondary query for product info
$sql2 = "
SELECT product_name
FROM dealer_product
WHERE product_id='".$cart_item[1]."'
AND status='A'
";
$result2=mysql_query($sql2);
$cart_product=mysql_fetch_array($result2);
// add line item to table
$cart_display.="
<tr>
<td align='center'>".$cart_item[1]."</td>
<td align='left'>".$cart_product[0]."</td>
<td align='center'>$".number_format($cart_item[3], 2)."</td>
<td align='center'>".$cart_item[2]."</td>
<td align='right'>$".number_format(($cart_item[2]*$cart_item[3]), 2)."</td>
</tr>
";
}// ends while($cart_item=mysql_fetch_array($result))
// ### finished dealing with individual items - now deal with cart as a whole
// Need a total line
$cart_display.="
<tr>
<td align='left'>Date Ordered : </td>
<td align='left' colspan='2'>".$created."</td>
<td align='right'>Total </td>
<td align='right'>".$sub_total."</td>
</tr>
</table>
";// End of building cart display
print"<br><br>";
print $cart_display;
print "<br><br></td></tr>";
// 2 links - 1 for Return to Cart and 1 for Submit Purchase Order
?>
<tr>
<td align='center'>
<form name="shop" action="<?php print $_SERVER['PHP_SELF']; ?>" method="POST">
<input type="image" name="shop" src="images/cart_view.png" width="220" height="50" border="0" alt="Continue Shopping">
</form>
</td>
<td align='center'>
<form name="shop" action="<?php print $_SERVER['PHP_SELF']; ?>" method="POST">
<input type='hidden' name='sub_act' value='submit_order'>
<input type='hidden' name='cart_display' value='$cart_display'>
<input type="image" name="submit" src="images/button_submit_blue.png" width="220" height="50" border="0" alt="Submit Purchase Order">
</form>
</td>
</tr>
But what I get is when it is supposed to display the submit button image, instead, it displays the entire shopping cart
A little baffled, but maybe I'm trying to do something that I can't do.
Any guidance with this would be greatly appreciated.
Douglas