<? session_start(); $id_product=$_POST[id_product]; $id_color=$_POST[id_color]; $_SESSION["myCart"]= $myCart; $_SESSION['sess_num']=$sess_num; if(count($myCart)==0) { $check=1; } else if (!in_array($myCart,$myCart)) { $check=1; } if ($check==1) { include "connect.php"; $sql = "select * from tb_product where id_prd = '$id_product' " ; $result = mysql_db_query($dbname,$sql); $rs = mysql_fetch_array($result); $sess_id[] = $rs[id_prd]; $sess_name[] = $rs[name]; $sql1 = "select * from color where id_color = '$id_color' " ; $result1 = mysql_db_query($dbname,$sql1); $rs1 = mysql_fetch_array($result1); $sess_id_color[] = $rs1[id_color]; $sess_name_color[] = $rs1[name_color]; $myCart=array($sess_id,$sess_id_color); $sess_num [] =1; } print_r ($myCart); // header ("Location: page3.php" ) ; // session_destroy(); ?>
$product = array(); $product['shirt'][] = "T-shirt"; $product['shirt'][] = "T-shirt"; $product['color'][] = "Black"; $product['color'][] = "Blue"; print_r ($product);
<? session_start(); $id_product=$_POST[id_product]; $id_color=$_POST[id_color]; $_SESSION[numb]=$num; $product = array(); for($i=0;$i<=$numb;$i++){ $product['shirt'][$i] = "$id_product"; $product['color'][$i] = "$id_color"; } print_r ($num); echo"<br><br><br>"; print_r ($product); ?>
session_start(); $_SESSION['shirt'][] = 1; $_SESSION['color'][] = 4; print_r ($_SESSION);
<? session_start(); $id_product=$_POST[id_product]; $id_color=$_POST[id_color]; $_SESSION['cart'][] = array( "qty" => $id_color, "productId" => $id_product, ); if(isset($_SESSION['cart'])) { foreach($_SESSION['cart'] as $cartItems) { else { $_SESSION['cart'][] = array( "qty" => $id_color, "productId" => $id_product, ); } } } else { $_SESSION['cart'][] = array( "qty" => $id_color, "productId" => $id_product, ); } print_r($cart); ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง