javascript - Pass shopping cart details to Purchase Order Form -
i have webpage product store split 3 frames
- left hand side pane/frame displays products
- middle of page split 2 -
top_half
- displays product details , quantity user wants add when product selected. bottom_half
of frame displays shopping cart when select 'submit' in top half.
i want submit information shopping cart(bottom_half
) display contents in top_half
order form customer details.. close session , display " complete checkout please fill in information above"
cart.php (bottom_half)
<?php session_start(); ?> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>my grocery store</title> <link rel="stylesheet" type="text/css" href="css_prod.css"> </head> <body> <h2>my shopping cart</h2> <?php if(isset($_post['empty_cart'])) { $_session=array(); session_desrtoy(); } require_once 'class_product.php'; $product = unserialize($_session['product']); $quantity = $_post['cart']; $total_price = 0; echo '<table class="checkout">'; echo "<tr>"; echo "<th>product name</th>"; echo "<th>product id </th>"; echo "<th>in stock</th>"; echo "<th>price</th>"; echo "<th>quantity added</th>"; echo "<th>cost</th>"; echo "</tr>"; if(!isset($_session['cart_items'])) { $_session['cart_items'] = array(); } array_push($_session['cart_items'],$product->getproductname()."|".$product->getproductid()."|".$product->getstock()."|".$product->getunitprice()."|".$quantity."|".$sub_total); for($i=0;$i<sizeof($_session['cart_items']);$i++) { $sub_total = $product->getunitprice() * $quantity; $total_price += $sub_total; echo "<tr>"; //echo $_session['cart_items'][$i]."<br><hr>"; $params = explode("|",$_session['cart_items'][$i]); for($j=0;$j<sizeof($params);$j++) { if($j == 0) { echo "<th>".$params[$j]."</th>"; } else { echo "<td>".$params[$j]."</td>"; } } echo "</tr>"; } echo"<tr>"; echo "<td></td>"; echo "<td></td>"; echo "<td></td>"; echo "<td></td>"; echo "<td>total cost</td>"; echo "<td>$total_price</td>"; echo"</tr>"; echo "</table>"; ?> <form name="endform" method="post"> <button type="submit" name="empty_cart" value="delete" id="empty_cart">delete</button> <button type="submit" name="checkout" value="checkout" onlcick="purchase.php">checkout</button> </form> </body> </html>
Comments
Post a Comment