hi all my name is Fadil Raditya
i am stuck in some code in php. I really need help.
i want add item in chart from selected item how ever it can not increment.
this is some of my code.
<?php session_start();
require_once("dbcontroller.php");
$db_handle = new DBController();
if(!empty($_GET["action"])) {
switch($_GET["action"]) {
case "add":
if(!empty($_POST["quantity"])) {
$productByCode = $db_handle->runQuery("SELECT * FROM tblproduct WHERE code='" . $_GET["code"] . "'");
$itemArray = array($productByCode[0]["code"]=>array('name'=>$productByCode[0]["name"], 'code'=>$productByCode[0]["code"], 'quantity'=>$_POST["quantity"], 'price'=>$productByCode[0]["price"]));
if(!empty($_SESSION["cart_item"])) {
if(in_array($productByCode[0]["code"],$_SESSION["cart_item"])) {
foreach($_SESSION["cart_item"] as $k => $v) {
if($productByCode[0]["code"] == $k)
{
$_SESSION["cart_item"][$k]["quantity"] = $_POST["quantity"];
}
}
}
else {
$_SESSION["cart_item"] = array_merge($_SESSION["cart_item"],$itemArray);
}
} else {
$_SESSION["cart_item"] = $itemArray;
}
}
break;
and i want call adding the quantity when hit the add chart button
<?php
$product_array = $db_handle->runQuery("SELECT * FROM tblproduct ORDER BY id DESC");
if (!empty($product_array)) {
foreach($product_array as $key=>$value){
?>
<div class="col-xs-6 col-sm-3 col-md-3">
<div class="team-wrapper-big">
<form method="post" action="index.php?action=add&code=<?php echo $product_array[$key]["code"]; ?>">
<h6><?php echo $product_array[$key]["name"]; ?></h6>
<img src="<?php echo $product_array[$key]["image"]; ?>">
<?php echo "Rp ".$product_array[$key]["price"]; ?>
<hr>
<img src="img/VIEW.png">
<input type="text" name="quantity" value="1" placeholder="quantity in number" />
<input type="submit" value="Add to cart" class="btnAddAction" src="img/BUY.png">
<hr>
</form>
</div>
</div>
<?php
}
}
?>
This is the ouput source
<div id="shopping-cart">
<div class="txt-heading"></div>
<?php
if(isset($_SESSION["cart_item"])){
$item_total = 0;
?><center>
<table cellpadding="10" cellspacing="3" border="1">
<tbody>
<tr>
<th><strong>Name</strong></th>
<th><strong>Code</strong></th>
<th><strong>Quantity</strong></th>
<th><strong>Price</strong></th>
<th><strong>Total Price</strong></th>
<th><strong>Action</strong></th>
</tr>
<?php
foreach ($_SESSION["cart_item"] as $item){
?>
<tr>
<td><strong><?php echo $item["name"]; ?></strong></td>
<td><?php echo $item["code"]; ?></td>
<td><?php echo $item["quantity"]; ?></td>
<?php $_SESSION["track"] = $item["quantity"]; ?>
<td align=right><?php echo "Rp. ".$item["price"]; ?></td>
<td align=right><?php echo "Rp. ".$item["quantity"]*$item["price"]; ?></td>
<td>Remove Item</td>
</tr>
<?php
$item_total += ($item["price"]*$item["quantity"]);
}
?>
<tr>
<td colspan="6" align=right><strong>Total:</strong> <?php echo "Rp. ".$item_total; ?></td>
</tr>
</tbody>
</table> </center>
<?php
}
?><a id="btnEmpty" href="index.php?action=empty">Empty Cart</a>
</div>
i hope anyone can help me. need suggestion and solution. open to discussion.
regards
Fadil Raditya
Related
How can I separate the displayed files in col4? The problem is that all of the files are getting displayed in all the column.
This is my code:
<?php
include 'connection.php';
$query="SELECT * from test2";
$result=mysqli_query($con, $query);
while ($row = mysqli_fetch_assoc($result)) {
$data[$row['id']] = array("col1" => $row['id'],"col2" => $row['name'],
"col3" => $row['email'],"col4" => $row['file']);
}
$file=$_FILES['file'];
move_uploaded_file($file['tmp_name'], "Uploads/".$file['name']);
?>
<form action="#" method='post' enctype="multipart/form-data">
<input type="file" name="file" id="file"/><br><br>
<input type="submit" name="submit" value="Upload"/>
<table align="" border="1px solid black">
<tr>
<th>col4</th>
<th>col3</th>
<th>col2</th>
<th>col1</th>
</tr>
<?php
foreach ($data as $i) { ?>
/* here is the problem, all the files are displayed together */
<td><?php
$files=scandir("Uploads");
for ($a=2; $a < count($files) ; $a++) {
?>
<a download="<?php echo $files[$a]?>" href="Uploads/<?php echo
$files[$a]?>"><?php echo $files[$a] ?>;</a>
<?php
}?></td>
/* until here */
<td> <?php echo $i['col3']; ?></td>
<td> <?php echo $i['col2']; ?></td>
<td> <?php echo $i['col1']; ?></td>
</tr>
<?php } ?>
Simply add a <br/> after the </a>
<a download="<?php echo $files[$a]?>" href="Uploads/<?php echo
$files[$a]?>"><?php echo $files[$a] ?>;</a><br/>
I already have a working function in my model
//GETTING TOTAL PURCHASE
function total_portal_user_sale($user_id)
{
$return = 0;
$transection = $this->db->get('transection')->result_array();
foreach ($transection as $row) {
if ($row['buyer'] == $user_id) {
$return += $row['credit'];
}
}
return $return;
}
i am getting data from my database correctly but i need to filter result by where clause for example this query
$this->db->query("SELECT sum(credit) as total FROM transection
where buyer = $user_id and status like '%paid%'");
this is the same scenario but with data filtering, I don't know how to use my query with active record statement
if someone rewrite my
function total_portal_user_sale($user_id)
with my WHERE clause query i will appreciate it ...
this is how i am rendering data into tables in view file
<div class="panel-body" id="demo_s">
<table id="demo-table" class="table table-striped" data-pagination="true" data-show-refresh="false" data-ignorecol="0,6" data-show-toggle="false" data-show-columns="false" data-search="true" data-striped="true" data-filter-control="true" data-show-export="true" >
<thead>
<tr>
<th style="width:4ex"><input type="checkbox" id="users_idtog"/></th>
<th><?php echo translate('no');?></th>
<th><?php echo translate('image');?></th>
<th><?php echo translate('name');?></th>
<th><?php echo translate('email');?></th>
<th><?php echo translate('phone');?></th>
<th>Total<br>Sale</th>
<th>This<br>Month<br>Sale</th>
<th>Total Debit</th>
<th>Total<br>Profit</th>
<th><?php echo translate('creation');?></th>
<th>Monthly<br>Sale<br>Target</th>
<th>Coupon<br>Code</th>
<th>Coupon<br>Expiry<br>Date</th>
<th class="text-right"><?php echo translate('options');?></th>
</tr>
</thead>
<tbody >
<?php
$i = 0;
foreach($all_users as $row){
$i++;
?>
<tr>
<td><input type="checkbox" class="users_id" name="users_id[]" value="<?php echo $row['user_id']; ?>" /></td>
<td><?php echo $i; ?></td>
<td>
<img class="img-sm img-circle img-border"
<?php if(file_exists('uploads/user_image/user_'.$row['user_id'].'.jpg')){ ?>
src="<?php echo base_url(); ?>uploads/user_image/user_<?php echo $row['user_id']; ?>.jpg"
<?php } else if($row['fb_id'] !== ''){ ?>
src="https://graph.facebook.com/<?php echo $row['fb_id']; ?>/picture?type=large" data-im='fb'
<?php } else if($row['g_id'] !== ''){ ?>
src="<?php echo $row['g_photo']; ?>"
<?php } else { ?>
src="<?php echo base_url(); ?>uploads/user_image/default.png"
<?php } ?> />
</td>
<td><?php echo $row['username']; ?></td>
<td><a href="mailto:<?php echo $row['email']; ?>" target="_self" ><?php echo $row['email']; ?></td>
<td><?php echo $row['phone']; ?></td>
<td class="text-right"><?php echo $this->crud_model->total_purchase($row['user_id']); ?></td>
<td class="text-right">
<?php
$Days = explode("-",date("d-m-Y"));
echo round($this->crud_model->sale_target($Days[0],$row['user_id']),2);
?>
</td>
<td class="text-right"><?php echo $this->crud_model->total_profit($row['user_id']); ?></td>
<?php
$ts = $this->crud_model->total_portal_user_sale($row['user_id']);
$tc = $this->crud_model->total_portal_user_profit($row['user_id']);
$tp = $ts - $tc
?>
<td class="text-right">
<?php echo $ts; ?>
</td>
<td class="text-right"><?php echo date('d M,Y',$row['creation_date']);?></td>
<td><?php echo $row['monthly_sale_target']; ?></td>
<td><?php echo $row['coupon_code']; ?></td>
<td><?php echo $row['expiry_date']; ?></td>
<td class="text-right">
<a class="btn btn-purple btn-xs btn-labeled fa fa-tag" data-toggle="tooltip"
onclick="ajax_modal('add_discount','<?php echo translate('give_target_discount'); ?>','<?php echo translate('adding_discount!'); ?>','add_discount','<?php echo $row['user_id']; ?>')" data-original-title="Edit" data-container="body">
<?php echo translate('give_discount');?>
</a>
<a class="btn btn-success btn-xs btn-labeled fa fa-wrench" data-toggle="tooltip"
onclick="ajax_modal('edit','<?php echo translate('edit_user'); ?>','<?php echo translate('successfully_edited!'); ?>','user_edit','<?php echo $row['user_id']; ?>')"
data-original-title="Edit" data-container="body">
<?php echo translate('edit');?>
</a>
<a onclick="delete_confirm('<?php echo $row['user_id']; ?>','<?php echo translate('really_want_to_delete_this?'); ?>')" class="btn btn-xs btn-danger btn-labeled fa fa-trash" data-toggle="tooltip"
data-original-title="Delete" data-container="body">
<?php echo translate('delete');?>
</a>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
Hope this will help you :
function total_portal_user_sale($user_id)
{
$return = 0;
$this->db->select('*');
//$this->db->select('sum(credit) as total,buyer');
$this->db->from('transection');
$this->db->where('buyer',$user_id);
$this->db->like('status','paid');
$query = $this->db->get();
if ($query->num_rows() > 0 )
{
foreach ($query->result_array() as $row)
{
if ($row['buyer'] == $user_id)
{
$return += $row['credit'];
}
}
return $return;
}
}
You can also use $this->db->select_max('credit') for the same
For more : https://www.codeigniter.com/user_guide/database/query_builder.html
I just want the table show the category name rather than showing its ID to the user...So I just added $data['category'] object in my Controller
Controller Code:
$Query="group by product_image order by product_id";
$data["products"] = $this->insert->Select('product',$Query);
foreach ($data['products'] as $waste) {
$qry = "where id=".$waste->product_category;
$cat[] = $this->insert->select('category',$qry);
}
$data['category'] = $cat;
//print_r($data["products"]);
$this->load->view('manage/product/list',$data);
View Code:
if(!empty($products)) {
$l=0;
$base_url=$this->config->item('base_url');
$tot = count($products);
foreach($products as $products_info) {
$l++; ?>
<tr>
<td valign="middle"><div class="checkbox check-default">
<!-- <input type="checkbox" value="3" id="checkbox2" />
<label for="checkbox2"></label> !-->
</div></td>
<td valign="middle"><?php echo $products_info->product_id;?></td>
<td valign="middle"><?php echo $products_info->product_code;?></td>
<td valign="middle"><?php echo $products_info->product_name;?>-<?php echo $products_info->prod_weight;?></td>
<td valign="middle"><a target="_new" href="<?php echo $base_url. "product/".$products_info->product_image;?>"><img src="<?php echo $base_url. "product/".$products_info->product_image;?>" width="75" height="30" alt="" /></a></td>
<td valign="middle"><?php echo $products_info->product_amount; ?></td>
<td valign="middle">
<?php foreach($category as $cat) { ?>
<?php echo $cat[0]->category_title; ?>
<?php } ?>
</td>
<td><?php if($products_info->status==1) {?>
<button Placeid="<?php echo $products_info->id;?>" action='1' class="btn btn-mini btn-success status-btn">Approved</button>
<?php } else { ?>
<button Placeid="<?php echo $products_info->id;?>" action='0' class="btn btn-mini btn-danger status-btn">UnApproved</button>
<?php } ?>
</td>
The Output image of this Code =>
but I just want to show the correct category to the corresponding row..So please help to get off from this...Waiting for possible solutionzzz
No need multiple query : simple use INNER JOIN .
select * from product as p inner join category as c on p.product_category=c.id
Shown in the image above, I have two entries on my stock_transfer table.
As an example, I will insert two different values to show you that it's working. (5 stocks on Product 1 and 10 stocks on Product 2)
Now, when I try to insert the stocks requested remaining on Product 1 and leave the Product 2, it will be successful.
Here comes the problem. When I try to insert value (290 stocks) on my Product 2, it will insert the value in the Product 1 table.
Can anyone help me with this? Here's my query code:
if (isset($_POST['addCart']) && $_POST['addCart']=="Confirm Stock Transfer") {
foreach($_POST['qtyBuy'] as $index=>$value){
if($value > 0){
$cartProd_id = $_POST['product_id'][$index];
$cartProd_name = $_POST['product_name'][$index];
$cartProd_date = $_POST['product_exp'][$index];
$cartProd_desc = $_POST['product_desc'][$index];
$cartProd_transid = $_POST['transfer_id'][$index];
//Update stock_transfer requests
$update_stock = "UPDATE stock_transfer SET stocks_transferred = stocks_transferred + $value WHERE transfer_id = $cartProd_transid;";
$update_stockE = mysqli_query($connection, $update_stock);
Here's is my code:
<table class="table table-striped table-bordered table-hover results table-fixed table-condensed" id="example">
<thead>
<tr>
<th>#</th>
<th>Product Name</th>
<th>Description</th>
<th>Sell Price</th>
<th>Expiry Date</th>
<th>Instock</th>
<th>Stocks Requested Remaining</th>
<th>Stocks Transferred</th>
<th>Quantity to Transfer</th>
</tr>
</thead>
<tbody>
<?php
$getReq = "SELECT * FROM stock_transfer INNER JOIN td_products ON stock_transfer.transfer_product_id = td_products.product_id WHERE stock_transfer.transfer_number = $tid AND stock_transfer.transfer_tobranch = '$capitalPrefix';";
$getReqE = mysqli_query($connection, $getReq);
while ($row = mysqli_fetch_array($getReqE)) {
$transfer_id = $row['transfer_id'];
$transfer_number = $row['transfer_number'];
$transfer_status = $row['transfer_status'];
$transfer_frombranch = $row['transfer_frombranch'];
$transfer_tobranch = $row['transfer_tobranch'];
$transfer_product_id = $row['transfer_product_id'];
$transfer_quantity = $row['transfer_quantity'];
$transfer_date = $row['transfer_date'];
$stocks_transferred = $row['stocks_transferred'];
$remainingStocks = $transfer_quantity - $stocks_transferred;
$product_id = $row['product_id'];
$product_name = $row['product_name'];
$product_price = $row['sell_price'];
$description = $row['description'];
$quantity = $row['quantity'];
$expiry_date = $row['expiry_date'];
echo $transfer_id;
?>
<tr>
<td class="text-center"><?php echo $product_id; ?>
<input type="hidden" name="product_id[]" value="<?php echo $product_id; ?>">
</td>
<input type="hidden" name="transfer_id[]" value="<?php echo $transfer_id; ?>">
<td><?php echo $product_name; ?>
<input type="hidden" name="product_name[]" value="<?php echo $product_name; ?>">
</td>
<td><?php echo $description; ?>
<input type="hidden" name="product_desc[]" value="<?php echo $description; ?>">
</td>
<td>₱ <?php echo number_format($product_price, 2); ?></td>
<td><?php echo $expiry_date; ?>
<input type="hidden" name="product_exp[]" value="<?php echo $expiry_date; ?>">
</td>
<td><strong><?php echo $quantity; ?></strong></td>
<td><?php echo $remainingStocks; ?></td>
<td><?php echo $stocks_transferred; ?></td>
<td>
<?php if (!$remainingStocks == 0){ ?>
<input type="number" name="qtyBuy[]" id="<?php echo "qtyBuy" . $b++; ?>" min="1" max="<?php echo $remainingStocks;?>">
<?php } else{ ?>
<i class="glyphicon glyphicon-check"></i> Completed
<?php } ?>
</td>
</tr>
<?php }?>
</tbody>
</table>
<div class="form-group">
<input type="submit" name="addCart" value="Confirm Stock Transfer" class="btn btn-info pull-right">
Back to Request List
</div>
Tags
Here's my schema:
See this:
<td>
<input type="number" name="qtyBuy[]" id="<?php echo "qtyBuy" . $b++; ?>" min="1" max="<?php echo $remainingStocks;?>" <?php echo ($remainingStocks == 0') ? 'Disabled=true' : '';?> value="0">
</td>
for security issues, I advise you to use ajax and submit just the qty input for one row each time:
<table class="table table-striped table-bordered table-hover results table-fixed table-condensed" id="example">
<thead>
<tr>
<th>#</th>
<th>Product Name</th>
<th>Description</th>
<th>Sell Price</th>
<th>Expiry Date</th>
<th>Instock</th>
<th>Stocks Requested Remaining</th>
<th>Stocks Transferred</th>
<th>Quantity to Transfer</th>
</tr>
</thead>
<tbody>
<?php
$getReq = "SELECT * FROM stock_transfer INNER JOIN td_products ON stock_transfer.transfer_product_id = td_products.product_id WHERE stock_transfer.transfer_number = $tid AND stock_transfer.transfer_tobranch = '$capitalPrefix';";
$getReqE = mysqli_query($connection, $getReq);
while ($row = mysqli_fetch_array($getReqE)) {
$transfer_id = $row['transfer_id'];
$transfer_number = $row['transfer_number'];
$transfer_status = $row['transfer_status'];
$transfer_frombranch = $row['transfer_frombranch'];
$transfer_tobranch = $row['transfer_tobranch'];
$transfer_product_id = $row['transfer_product_id'];
$transfer_quantity = $row['transfer_quantity'];
$transfer_date = $row['transfer_date'];
$stocks_transferred = $row['stocks_transferred'];
$remainingStocks = $transfer_quantity - $stocks_transferred;
$product_id = $row['product_id'];
$product_name = $row['product_name'];
$product_price = $row['sell_price'];
$description = $row['description'];
$quantity = $row['quantity'];
$expiry_date = $row['expiry_date'];
echo $transfer_id;
?>
<tr>
<td class="text-center"><?php echo $product_id; ?>
</td>
<td><?php echo $product_name; ?>
</td>
<td><?php echo $description; ?>
</td>
<td>₱ <?php echo number_format($product_price, 2); ?></td>
<td><?php echo $expiry_date; ?>
</td>
<td><strong><?php echo $quantity; ?></strong></td>
<td><?php echo $remainingStocks; ?></td>
<td><?php echo $stocks_transferred; ?></td>
<td>
<?php if (!$remainingStocks == 0){ ?>
<input type="number" name="qtyBuy[]" id="qty_buy_<?= $transfer_id ?>" min="1" max="<?php echo $remainingStocks;?>"><a class="btn btn-sm add_qty" data-id="<?= $transfer_id ?>"></a>
<?php } else{ ?>
<i class="glyphicon glyphicon-check"></i> Completed
<?php } ?>
</td>
</tr>
<?php }?>
</tbody>
</table>
<div class="form-group">
<input type="submit" name="addCart" value="Confirm Stock Transfer" class="btn btn-info pull-right">
Back to Request List
</div>
<script>
$(function() {
$('.add_qty').click(function() {
var id = $(this).data('id');
var qty = $("#qty_buy_"+id).val();
$.ajax({
type: 'GET',
url:'/your_action',
data: {id : id, qty : qty},
dataType: 'JSON',
}).done(function(json){
// code to update the values in your row
});
});
});
</script>
The problem was on the
<?php if (!$remainingStocks == 0){ ?>
<input type="number" name="qtyBuy[]" id="<?php echo "qtyBuy" . $b++; ?>" min="1" max="<?php echo $remainingStocks;?>">
<?php } else{ ?>
<i class="glyphicon glyphicon-check"></i> Completed
<?php } ?>
I think the problem is with your input names. You have assigned arrays as names of your inputs. Try to make them unique using the product id.
I am after two bits of advice for a project I am working on and would really appreciate any advice you may have..
I have the below code and its working really well as a shopping cart for a student project. At the end of the code, I would like to save all the items added to the shopping cart in the table at the bottom to a MySQL table called orders for example.
Is this possible to do?
Also, for each item for sale on the page there is an image. Is it possible hover over the image and the description from the MySQL table is shown in a hover box?
<?php
session_start();
$connect = mysqli_connect("localhost", "root", "", "WineCellar");
if(isset($_POST["add_to_cart"]))
{
if(isset($_SESSION["shopping_cart"]))
{
$item_array_id = array_column($_SESSION ["shopping_cart"], "item_id");
if(!in_array($_GET["id"], $item_array_id))
{
$count = count($_SESSION["shopping_cart"]);
$item_array = array(
'item_id' => $_GET["id"],
'item_name' => $_POST["hidden_name"],
'item_price' => $_POST["hidden_price"],
'item_quantity' => $_POST["quantity"]
);
$_SESSION["shopping_cart"][$count] = $item_array;
}
else
{
echo '<script>alert("Item Already Added")</script>';
echo '<script>window.location="Shop.php"</script>';
}
}
else
{
$item_array = array(
'item_id' => $_GET["id"],
'item_name' => $_POST["hidden_name"],
'item_price' => $_POST["hidden_price"],
'item_quantity' => $_POST["quantity"]
);
$_SESSION["shopping_cart"][0] = $item_array;
}
}
if(isset($_GET["action"]))
{
if($_GET["action"] == "delete")
{
foreach($_SESSION["shopping_cart"] as $keys => $values)
{
if($values["item_id"] == $_GET["id"])
{
unset($_SESSION["shopping_cart"][$keys]);
echo '<script>alert("Item Removed")</script>';
echo '<script>window.location="shop.php"</script>';
}
}
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>The Wine Cellar</title>
<script src="style/jquery.min.js"></script>
<link rel="stylesheet" href="style/bootstrap.min.css" />
<script src="style/bootstrap.min.js"></script>
</head>
<body>
<br />
<div class="container" style="width:700px;">
<h3 align="center"><img src="Images/slide1.jpg" width="644" height="176"></h3>
<p align="center"><br />
<?php
$query = "SELECT * FROM tbl_product ORDER BY id ASC";
$result = mysqli_query($connect, $query);
if(mysqli_num_rows($result) > 0)
{
while($row = mysqli_fetch_array($result))
{
?>
</p>
<div class="col-md-4">
<form method="post" action="shop.php?action=add&id=<?php echo $row["id"]; ?>">
<div style="border:1px solid #333; background-color:#f1f1f1; border-radius:5px; padding:16px;" align="center">
<img src="<?php echo $row["image"]; ?>" class="img-responsive" /><br />
<h4 class="text-info"><?php echo $row["name"]; ?></h4>
<h4 class="text-danger">$ <?php echo $row["price"]; ?></h4>
<input type="text" name="quantity" class="form-control" value="1" />
<input type="hidden" name="hidden_name" value="<?php echo $row["name"]; ?>" />
<input type="hidden" name="hidden_price" value="<?php echo $row["price"]; ?>" />
<input type="submit" name="add_to_cart" style="margin-top:5px;" class="btn btn-success" value="Add to Cart" />
</div>
</form>
</div>
<?php
}
}
?>
<div style="clear:both"></div>
<br />
<h3>Order Details</h3>
<div class="table-responsive">
<table class="table table-bordered">
<tr>
<th width="40%">Item Name</th>
<th width="10%">Quantity</th>
<th width="20%">Price</th>
<th width="15%">Total</th>
<th width="5%">Action</th>
</tr>
<?php
if(!empty($_SESSION["shopping_cart"]))
{
$total = 0;
foreach($_SESSION["shopping_cart"] as $keys => $values)
{
?>
<tr>
<td><?php echo $values["item_name"]; ?></td>
<td><?php echo $values["item_quantity"]; ?></td>
<td>$ <?php echo $values["item_price"]; ?></td>
<td>$ <?php echo number_format($values["item_quantity"] * $values["item_price"], 2); ?></td>
<td><span class="text-danger">Remove</span></td>
</tr>
<?php
$total = $total + ($values["item_quantity"] * $values["item_price"]);
}
?>
<tr>
<td colspan="3" align="right">Total</td>
<td align="right">$ <?php echo number_format($total, 2); ?></td>
<td></td>
</tr>
<?php
}
?>
</table>
</div>
</div>
<br />
</body>
</html>
Thanks in advance
Shane