Hi i have a js shopping cart i ant to post the cart to mysql database using php
this is the js code
// Displays the shopping cart/////////////////////
displayCart: function() {
if( this.$formCart.length ) {
var cart = this._toJSONObject( this.storage.getItem( this.cartName ) );
var items = cart.items;
var $tableCart = this.$formCart.find( ".shopping-cart" );
var $tableCartBody = $tableCart.find( "tbody" );
for( var i = 0; i < items.length; ++i ) {
var item = items[i];
var product = item.product;
var price = this.currency + " " + item.price;
var qty = item.qty;
var html = "<tr><td class='pname'>" + product + "</td>" + "<td class='pqty'>" + qty + "</td>" + "<td class='pprice'>" + price + "</td></tr>";
$tableCartBody.html( $tableCartBody.html() + html );
}
var total = this.storage.getItem( this.total );
this.$subTotal[0].innerHTML = this.currency + " " + total;
} else if( this.$checkoutCart.length ) {
var checkoutCart = this._toJSONObject( this.storage.getItem( this.cartName ) );
var cartItems = checkoutCart.items;
var $cartBody = this.$checkoutCart.find( "tbody" );
for( var j = 0; j < cartItems.length; ++j ) {
var cartItem = cartItems[j];
var cartProduct = cartItem.product;
var price = this.currency + " " + cartItem.price;
var cartQty = cartItem.qty;
var cartHTML = "<tr><td class='pname'>" + cartProduct + "</td>" + "<td class='pqty'>" + cartQty + "</td>" + "<td class='pprice'>" + price + "</td></tr>";
$cartBody.html( $cartBody.html() + cartHTML );
}
var cartTotal = this.storage.getItem( this.total );
var cartShipping = this.storage.getItem( this.shippingRates );
var subTot = this._convertString( cartTotal ) + this._convertString( cartShipping );
this.$subTotal[0].innerHTML = this.currency + " " + this._convertNumber( subTot );
this.$shipping[0].innerHTML = this.currency + " " + cartShipping;
}
},
// Empties the cart by calling the _emptyCart() method
// @see $.Shop._emptyCart()
emptyCart: function() {
var self = this;
if( self.$emptyCartBtn.length ) {
self.$emptyCartBtn.on( "click", function() {
self._emptyCart();
});
}
},
///////////////////////////////end js code//////////////////////////////////////////////////////////////////////////////////////
all the shopping cart details are passed to a html form
<table width="70%" id="checkout-cart" class="shopping-cart">
<thead>
<tr>
<th width="33%" height="25" bgcolor="#E8E8E8" scope="col">Item</th>
<th width="13%" bgcolor="#E8E8E8" scope="col">Qty</th>
<th width="54%" bgcolor="#E8E8E8" scope="col">Price</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
how do i seperate the items between the <tbody> tags and send to php any help please.
thanks