Ok, I am kicking myself, because I had this giving me a total before, but now, It does not grab ALL items chosen for sale, and it does not total correctly. How do I get this to total correctly. There are two types of products and two tables populating these rows, one type is OrderIn_Id and the other is OrderOut_Id. The products are populating perfectly, just not getting a total, and gives me an error of underfined variable, if a person only chooses one type of product, like the OrderIn_id products, then PriceOut gives an error of undefined variable. Can you help?
<?php
echo "<table class='middlecheckOut'>
<tr>
<td class='td2'><b>Order ID: </b></td>
<td class='td2'><b>Product Name: </b></td>
<td class='td2'><b>Quantity: </b></td>
<td class='td2'><b>Price: </b></td>
</tr>";
if (isset($_GET['user_id'])) {
$user_id = $_GET['user_id'];
} elseif (isset($_POST['user_id'])) {
$user_id = $_POST['user_id'];
}
$display="SELECT *
FROM order_instate JOIN in_Product ON
order_instate.ip_id = in_product.ip_id
WHERE user_id = '$user_id'; " ;
$displayResult = @mysqli_query($dbhandle, $display)
or die(mysqli_error($dbhandle));
while($row = mysqli_fetch_array($displayResult, MYSQLI_ASSOC)) {
if($row['orderIn_complete'] == "No") {
echo "<tr>
<td class='td2'>" . $row['orderIn_id'] . "   </td>
<td class='td2'>" . $row['ip_name'] . "   </td>
<td class='td2'>" . $row['orderIn_quantity'] . "   </td>
<td class='td2'>$" . $row['orderIn_total'] . "   </td>
</tr>";
$priceIn = NULL;
$priceIn += $row['orderIn_total'];
}
}
if (isset($_GET['user_id'])) {
$user_id = $_GET['user_id'];
} elseif (isset($_POST['user_id'])) {
$user_id = $_POST['user_id'];
}
$display2="SELECT *
FROM order_outstate JOIN op_Product ON
order_outstate.op_id = op_product.op_id
WHERE user_id = '$user_id'; " ;
$displayResult = @mysqli_query($dbhandle, $display2)
or die(mysqli_error($dbhandle));
while($row2 = mysqli_fetch_array($displayResult, MYSQLI_ASSOC)) {
if($row2['orderOut_complete'] == "No") {
echo "<tr>
<td class='td2'>" . $row2['orderOut_id'] . "   </td>
<td class='td2'>" . $row2['op_name'] . "   </td>
<td class='td2'>" . $row2['orderOut_quantity'] . "   </td>
<td class='td2'>$" . $row2['orderOut_total'] . "   </td>
</tr>";
$priceOut = NULL;
$priceOut += $row2['orderOut_total'];
}
}
echo "</table>";
$subtotal = 0;
$tax = 0;
$gtotal = 0;
$subtotal = number_format($priceIn + $priceOut, 2);
$tax = number_format($subtotal * .074, 2);
$gtotal = number_format($subtotal + $tax, 2);
?>