<? session_start(); ?> <?php ob_start(); ?> <? $id_type_select=$_GET[id_type]; ?> <? $page=$_GET[page]; if ($page=="") { $page=1; } $each=5; ?> <script> function checkItAll(myfrm,checkbox){ for(i=0; i<myfrm.length; i++){ if(checkbox.checked){ if(myfrm[i].disabled == false) myfrm[i].checked=true; }else myfrm[i].checked=false; } } </script> <html> <head> <title> Notebook Shop </title> </head> <body> <form name="from1" action="basket_add.php" method="post" > <h2><font color=red>: : Notebook Shop : : </font></h2> <p> [ <a href="index1.php">หน้าแรก</a> ] [ <a href="basket.php">ดูตะกร้าสินค้า</a> ] </p> <table width="770" border="0"> <tr> <td width="174" height="200" valign="top" bgcolor="#eaeaea"> <center><b>ประเภทสินค้า</b></center> <? include "connect.php"; include "type_list.php"; ?> </td> <td width="580" valign="top"><div align="center"> <table width="100%" border="0" cellspacing="4"> <? $sql="select * from tb_product where ref_id_type='$id_type_select' "; $result=mysql_db_query($dbname,$sql); $total=mysql_num_rows($result); $totalpages=ceil($total/$each); $goto=($page-1)*$each; $sql="select * from tb_product where ref_id_type='$id_type_select' order by id_prd desc LIMIT $goto,$each"; $result=mysql_db_query($dbname,$sql); while ($rs=mysql_fetch_array($result)) { $id_prd=$rs[id_prd]; $code=sprintf("%05d",$id_prd); $name_prd=$rs[name_prd]; $detail_prd=$rs[detail_prd]; $ref_id_type=$rs[ref_id_type]; $price_prd=$rs[price_prd]; $photo_prd=$rs[photo_prd]; if ($photo_prd=="") { $photo_prd="temp.jpg"; } $price_prd=number_format($price_prd,2); echo "<tr> <td width='10%' valign='center'> <img src='photo/$photo_prd' > <BR><input type=\"checkbox\" name=\"id_prd[]\" value=\"" . $rs["id_prd"] . "\"> </td> <td width='80%' valign='top'> <b>รหัสสินค้า :</b> $code <br> <b>ชื่อสินค้า : </b>$name_prd <br> <b>ราคา :</b> $price_prd บาท<br> <h5><font color=red>(สินค้านี้ยังไม่รวมภาษีมูลค่าเพิ่ม)</font></h6> [ <a href=' prd_view.php?id_prd=$id_prd'>แสดงรายละเอียด </a> ] [ <a href=' basket_add.php?id_prd=$id_prd'> หยิบใส่ตะกร้า </a> ] <br> </td> </tr>"; } ?> </table> </td> </tr> </table> <center><input type="submit" name="submit" value="สั่งซื้อ"> <input type="checkbox" onclick="javascript:checkItAll(this.form,this);"><font color=red><b> เลือกทั้งหมด/ยกเลิกทั้งหมด</b></font> </center> </form> <? $sql="select * from tb_type"; $result=mysql_db_query($dbname,$sql); echo "<UL>"; while ($rs=mysql_fetch_array($result)) { $id_type=$rs[id_type]; } if ($totalpages>1) { echo "<B>หน้า $page</B><BR>"; for ($i=1;$i<=$totalpages;$i++) { echo "[<A HREF='prd_list.php?id_type=$id_type_select&page=$i'>$i]</A>"; } } ?> </body> </html>
<? session_start(); print_r($_POST["id_prd"]); session_register("sess_id"); session_register("sess_name"); session_register("sess_price"); session_register("sess_num"); if (count ($sess_id)=="0") { $check=1; } else if (!in_array($id_prd,$sess_id)) { $check=1; } if ($check==1) { include "connect.php"; $sql="select * from tb_product where id_prd='$id_prd'"; $result=mysql_db_query($dbname,$sql); $rs=mysql_fetch_array($result); $sess_id[]=$rs[id_prd]; $sess_name[]=$rs[name_prd]; $sess_price[]=$rs[price_prd]; $sess_num[]=1; } header("Location: basket.php"); ?>
<? session_start(); ?> <html> <head> <title> Notebook Shop </title> </head> <body> <h2><font color=red>: : Notebook Shop : : </font></h2> <p> [ <a href="index1.php">หน้าแรก</a> ] [ <a href="basket.php">ดูตะกร้าสินค้า</a> ] </p> <table width="770" border="0"> <tr> <td width="174" height="200" valign="top" bgcolor="#eaeaea"> <center><b>ประเภทสินค้า</b></center> <? include "connect.php"; include "type_list.php"; ?> </td> <td width="600" valign="top"> <? if (count ($sess_id)==0) { echo "ยังไม่มีสินค้าอยู่ในตะกร้าครับ<br>"; } else { ?> <form method="post" action="basket_cal.php"> <table width="100%" border="1"> <td width="6%"><center><b>ลบ</b></center></td> <td width="50%"><center><b>ชื่อสินค้า</b></center></td> <td width="12%"><center><b>จำนวน</b></center></td> <td width="15%"><center><b>ราคา/บาท</b></center></td> <td width="15%"><center><b>รวม/บาท</b></center></td> </tr> <? for ($i=0;$i<count ($sess_id);$i++) { $total_unit=$sess_num[$i]*$sess_price[$i]; $total=$total+$total_unit; $total_unit=number_format($total_unit); echo $_SESSION['sess_name']; echo " <tr> <td><center> <input type='checkbox' name='prd_del[]' value='$sess_id[$i]'></center></td> <td>$sess_name[$i]</td> <td><center> <input type='text' name='prd_num[]' value='$sess_num[$i]' size='4'></center></td> <td><center>$sess_price[$i]</center></td> <td><center>$total_unit</center></td> </tr>"; } ?> </table> <p align="right"> <? echo" จำนวนเงินทั้งหมด $total_unit บาท"; ?><br><br> <input type="submit" name="calculate" value="คำนวนใหม่"> <input type="submit" name="complete" value="สั่งซื้อสินค้า"> </p> </form> <? } ?> </td> </tr> </table> </body> </html>
<!-- ระบบสั่งซื้อ --> <form name="myform" method="post" action='index.php?name=product&file=cart_add&id=<?echo $arr['news']['id'];?>'onsubmit="return checkform(this,sess_num);">จำนวน <input name="sess_num" type="text" style="width:50px" class='frindmenu'><INPUT TYPE="hidden" NAME="sess_codes" VALUE="<?=$sess_codes?>"> <input name="submit" type='submit' class='frindmenu' value=' สั่งซื้อสินค้า ' style="width:120px"></form>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง