I have a form full of check boxes to select different options for a product. Each option has a price, name and discription associated with it.
I am having trouble passing the multiple selections to a script that displays the options with the name, description and price. The script processes and displays the sub-total, tax and grand total of the selected options.
Right now it displays and shows the correct totals for all of the options, not the options selected. I have tried several different loops without success.
I can't get it to process and display only the options selected, it shows them all.
Here is the code, if anyone has any suggestions or solutions would be greatly appreciated.
<b>NOTE:</b> I removed the loop that didn't work to get the items selected.
<?
if ($check_array)
{
$item_id = implode($check_array, ",");
}
$item_query = 'SELECT * FROM category, item, other WHERE item_id=id';
$result = @($item_query);
if (! $result ) {
echo "A Fatal Error Has Occurred" . mysql_error(); die();
}
?>
<table align="center" width="600" border="1" cellspacing="1" cellpadding="1">
<tr>
<td><font face="Verdana" size="2"><b>Selected Items</b></td>
<td><font face="Verdana" size="2"><b>Item Discription</b></td>
<td><font face="Verdana" size="2"><b>Item Price</b></td>
</tr>
<?php
while ( $r = mysql_fetch_array($result) ) {
$id=$r['id'];
$cat_id=$r['cat_id'];
$cat_name=$r['cat_name'];
$category_id=$r['category_id'];
$item_id=$r['item_id'];
$item_name=$r['item_name'];
$item_description=$r['item_description'];
$item_price=$r['item_price'];
$item_description=$r['item_description'];
$item_number=$r['item_number'];
$tax_amount=$r['tax_amount'];
$total = $total + $item_price;
$format_total = number_format($total, 2);
$taxed = $tax_amount ".01";
$tax = $total $taxed;
$format_tax = number_format($tax, 2);
$grand_total = $format_tax + $total;
$gtf = number_format($grand_total, 2);
$displayInfo =
"<tr>
<td><font face=\"Verdana\" size=\"2\">$item_name</td>
<td><font face=\"Verdana\" size=\"2\">$item_description</td>
<td><font face=\"Verdana\" size=\"2\">$item_price</td>
</tr></font>";
echo "$displayInfo";
}
?>
</center>
<td><font face=\"Verdana\" size=\"2\">Sub Total $<? echo $format_total; ?><br>Tax (@ <? echo $tax_amount; ?>%) $<? echo $format_tax; ?><br>Grand Total <b>$<? echo $gtf; ?></b></td>
</table>