function emailtotal($cartid,$sess)
{
$query="SELECT product.category,product.make,product.price,orders.ID,orders.quantity FROM product,orders WHERE orders.cartID=$cartid AND orders.prodID=product.ID";
$result=mysql_query($query);
$row=mysql_fetch_array($result);
$goodstotal=0;
$category = $row["category"];
$make = $row["make"];
$price = $row["price"];
$quantity = $row["quantity"];
print("<table width=\"395\" border=0 cellpadding=0 cellspacing=0><tr><td height = \"20\" width=\"17\" class=\"menuheader\"><img src=\"images/r_div.gif\" width=\"17\" height=\"20\"></td><td width=\"378\" class=\"menuheader\">Your Cart Contents</td></tr></table>");
print("<table width=\"395\" border=0 cellpadding=3 cellspacing=1>");
print("<tr><td class=\"header2\" width=\"150\">Category</td><td width=\"150\" class=\"header2\">Product</td><td width=\"25\" class=\"header2\">Price</td><td width=\"15\" class=\"header2\">Qty</td><td class=\"header2\"> </tr>");
do
{
print("<tr><td class=\"searchlist\">".$category."</td><td class=\"searchlist\">".$make."</td><td class=\"searchlist\">".$price."</td><td align=\"center\" class=\"searchlist\">".$quantity."</td></tr>");
$carttotal=$carttotal+($row["price"]*$row["quantity"]);
}
return Array($category,$make);
}
In the file that you use to call this function simply...
list($category,$make) = emailtotal($cartid,$sess);
Now you have the vars the function used!