Posted: Sun Apr 06, 2003 12:39 pm
How will I do that?You will also have to take this outside the initial $message string and then continue.
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
How will I do that?You will also have to take this outside the initial $message string and then continue.
Code: Select all
<?
while($row = mysql_fetch_array($result))
{
// Increment the total cost of all items
$totalCost += ($rowї"qty"] * $rowї"itemPrice"]);
$unitCost = ($rowї"qty"] * $rowї"itemPrice"]);
$qty = $rowї"qty"];
$itemName = $rowї"itemName"];
$price = number_format($rowї"itemPrice"], 2, ".", ",");
$unitc = number_format($unitCost, 2, ".", ",");
$totalc = number_format($totalCost, 2, ".", ",");
$itemlist = "<tr><td width="15%" height="25">
<font face="verdana" size="1" color="black">
$qty
</font>
</td><td width="55%" height="25">
<font face="verdana" size="1" color="black">
$itemName
</font>
</td>
<td width="20%" height="25">
<font face="verdana" size="1" color="black">
£$price
</font>
</td>
<td width="20%" height="25">
<font face="verdana" size="1" color="black">
£$unitc
</font>
</td>
</tr>";
}
$message = "<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="15%" height="25" bgcolor="#99cc99">
<font face="verdana" size="1" color="#000000">
<b>Qty</b>
</font>
</td>
<td width="55%" height="25" bgcolor="#99cc99">
<font face="verdana" size="1" color="#000000">
<b>Product</b>
</font>
</td>
<td width="20%" height="25" bgcolor="#99cc99">
<font face="verdana" size="1" color="#000000">
<b>Price Each</b>
</font>
</td>
<td width="20%" height="25" bgcolor="#99cc99">
<font face="verdana" size="1" color="#000000">
<b>Total</b>
</font>
</td>
</tr><tr>$itemlist</tr><tr>
<td width="100%" colspan="3">
</td>
<td width="30%" colspan="2">
<font face="verdana" size="2" color="black">
<b>Total: £$totalc</b>
</font>
</td>
</tr>
</table>";
mail('info@larrytech.biz', 'Subject',
$message,
"To: The Receiver <recipient@some.net>\n" .
"From: The Sender <sender@some.net>\n" .
"MIME-Version: 1.0\n" .
"Content-type: text/html; charset=iso-8859-1");
?>
</form>
<a href="sendorder.php">Submit</a>
<?php
}
include("bottom.php");
?>Code: Select all
$itemlist="<html...";Code: Select all
$itemlist.="<html...";Code: Select all
$itemlist=$itemlist."<html...";Code: Select all
<?php
include("headers.php");
switch($_GETї"action"])
{
case "add_item":
{
AddItem($_GETї"id"], $_GETї"qty"]);
ShowCart();
break;
}
case "update_item":
{
UpdateItem($_GETї"id"], $_GETї"qty"]);
ShowCart();
break;
}
case "remove_item":
{
RemoveItem($_GETї"id"]);
ShowCart();
break;
}
default:
{
ShowCart();
}
}
function ShowCart()
{
// Gets each item from the cart table and display them in
// a tabulated format, as well as a final total for the cart
global $dbServer, $dbUser, $dbPass, $dbName;
// Get a connection to the database
$cxn = @ConnectToDb($dbServer, $dbUser, $dbPass, $dbName);
$totalCost = 0;
$result = mysql_query("select * from cart inner join items on cart.itemId = items.itemId where cart.cookieId = '" . GetCartId() . "' order by items.itemName asc");
?>
<html>
<head>
<title> Your Shopping Cart </title>
<script language="JavaScript">
function UpdateQty(item)
{
itemId = item.name;
newQty = item.optionsїitem.selectedIndex].text;
document.location.href = 'basket.php?action=update_item&id='+itemId+'&qty='+newQty;
}
</script>
</head>
<?
include("top.php");
?>
<h1>Your Basket</h1>
<form name="frmCart" method="get">
<?
while($row = mysql_fetch_array($result))
{
// Increment the total cost of all items
$totalCost += ($rowї"qty"] * $rowї"itemPrice"]);
$unitCost = ($rowї"qty"] * $rowї"itemPrice"]);
$qty = $rowї"qty"];
$itemName = $rowї"itemName"];
$price = number_format($rowї"itemPrice"], 2, ".", ",");
$unitc = number_format($unitCost, 2, ".", ",");
$totalc = number_format($totalCost, 2, ".", ",");
$itemlist. = "<tr><td width="15%" height="25">
<font face="verdana" size="1" color="black">
$qty
</font>
</td><td width="55%" height="25">
<font face="verdana" size="1" color="black">
$itemName
</font>
</td>
<td width="20%" height="25">
<font face="verdana" size="1" color="black">
£$price
</font>
</td>
<td width="20%" height="25">
<font face="verdana" size="1" color="black">
£$unitc
</font>
</td>
</tr>";
}
$message = "<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="15%" height="25" bgcolor="#99cc99">
<font face="verdana" size="1" color="#000000">
<b>Qty</b>
</font>
</td>
<td width="55%" height="25" bgcolor="#99cc99">
<font face="verdana" size="1" color="#000000">
<b>Product</b>
</font>
</td>
<td width="20%" height="25" bgcolor="#99cc99">
<font face="verdana" size="1" color="#000000">
<b>Price Each</b>
</font>
</td>
<td width="20%" height="25" bgcolor="#99cc99">
<font face="verdana" size="1" color="#000000">
<b>Total</b>
</font>
</td>
</tr><tr>$itemlist</tr><tr>
<td width="100%" colspan="3">
</td>
<td width="30%" colspan="2">
<font face="verdana" size="2" color="black">
<b>Total: £$totalc</b>
</font>
</td>
</tr>
</table>";
mail('info@larrytech.biz', 'Subject',
$message,
"To: The Receiver <recipient@some.net>\n" .
"From: The Sender <sender@some.net>\n" .
"MIME-Version: 1.0\n" .
"Content-type: text/html; charset=iso-8859-1");
?>
</form>
<a href="sendorder.php">Submit</a>
<?php
}
include("bottom.php");
?>Code: Select all
$itemlist. = "<tr><td width="15%" height="25">