<? session_start(); // Prepare Variable $cart = $_SESSION["cart"]; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>ระบบตะกร้าสินค้า - แสดงตะกร้าสินค้า</title> </head> <body> <div align="center"><h2>ตะกร้าสินค้า</h2></div> <? if (sizeof($cart) > 0) { ?> <form action="update_cart.php" method="post"> <table width="80%" border="1" align="center" cellpadding="5" cellspacing="1"> <tr> <th width="40">ลบ</th> <th width="80">ลำดับที่</th> <th>ชื่อสินค้า</th> <th width="80">ราคา</th> <th width="80">จำนวน</th> <th width="80">ราคารวม</th> </tr> <? $i = 0; $sum = 0; foreach ($cart as $pid => $item) { ?> <tr> <td align="center"><input type="checkbox" name="remove[]" value="<?=$id?>" /></td> <td align="center"><?=$i?></td> <td><?=$item["name"]?></td> <td align="right"><?=number_format($item["price"])?></td> <td align="center"> <input type="text" name="amount[<?=$pid?>]" size="2" value="<?=$item["amount"]?>" style="text-align: right" /> </td> <td align="right"><?=number_format($item["price"]*$item["amount"])?></td> </tr> <? $sum += $item["price"]*$item["amount"]; $i++; } ?> <tr> <td colspan="5" align="right">ราคารวมทั้งหมด</td> <td align="right"><?=number_format($sum)?></td> </tr> <tr> <td align="center" colspan="6"> <input type="button" value="กลับไปที่ผลการค้นหา" onclick="history.back();" /> <input type="submit" value="แก้ไขสินค้าในตะกร้า" /> <input type="button" value="ดำเนินการสั่งซื้อ" onclick="window.location='shipping_form.php';" /> </td> </tr> </table> </form> <? } else { ?> <div align="center"> <b>ไม่มีสินค้าในตะกร้า</b><br /> <a href="index.php">กลับไปที่ผลการค้นหา</a> </div> <? }?> </body> </html>
<body> <div align="center"><h2>ตะกร้าสินค้า</h2></div> <? if(!empty($_SESSION["cart"]) and count($_SESSION["cart"]) > 0){ if (sizeof($cart) > 0) { ?> <form action="update_cart.php" method="post"> <table width="80%" border="1" align="center" cellpadding="5" cellspacing="1"> <tr> <th width="40">ลบ</th> <th width="80">ลำดับที่</th> <th>ชื่อสินค้า</th> <th width="80">ราคา</th> <th width="80">จำนวน</th> <th width="80">ราคารวม</th> </tr> <? $i = 0; $sum = 0; foreach ($cart as $pid => $item) { ?> <tr> <td align="center"><input type="checkbox" name="remove[]" value="<?=$id?>" /></td> <td align="center"><?=$i?></td> <td><?=$item["name"]?></td> <td align="right"><?=number_format($item["price"])?></td> <td align="center"> <input type="text" name="amount[<?=$pid?>]" size="2" value="<?=$item["amount"]?>" style="text-align: right" /> </td> <td align="right"><?=number_format($item["price"]*$item["amount"])?></td> </tr> <? $sum += $item["price"]*$item["amount"]; $i++; } ?> <tr> <td colspan="5" align="right">ราคารวมทั้งหมด</td> <td align="right"><?=number_format($sum)?></td> </tr> <tr> <td align="center" colspan="6"> <input type="button" value="กลับไปที่ผลการค้นหา" onclick="history.back();" /> <input type="submit" value="แก้ไขสินค้าในตะกร้า" /> <input type="button" value="ดำเนินการสั่งซื้อ" onclick="window.location='shipping_form.php';" /> </td> </tr> </table> </form> <? } }else { ?> <div align="center"> <b>ไม่มีสินค้าในตะกร้า</b><br /> <a href="index.php">กลับไปที่ผลการค้นหา</a> </div> <? }?> </body>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง