<?php

session_start();

ob_start();

include_once("dbconnect.php");



include_once("checklogin.php");


 if(mysql_query("insert into tblcart(userid,grandtotal,status,ship,method) values('".$_SESSION['sirboxid']."','".$_SESSION['totalamounttax']."',0,'".$_SESSION['ship']."','".$_SESSION['service']."')"))

    {

	$cid=mysql_insert_id();

	$_SESSION['petercart_id']=$cid;

	$k=$_SESSION['sirboxcount'];

	for($i=1;$i<=$k;$i++)

    {
		/*echo "insert into tblcartdetails(cartid,productid,qty,colorindex,UNITPRICE,total,status,itemno,size) values('".$cid."','".$_SESSION['sirboxcart'][$i]["productId"]."','".$_SESSION['sirboxcart'][$i]["qty"]."','".$_SESSION['sirboxcart'][$i]["color"]."','".$_SESSION['sirboxcart'][$i]["price"]."','".$_SESSION['sirboxcart'][$i]["totprice"]."',0,'".$_SESSION['sirboxcart'][$i]["itemno"]."','".$_SESSION['sirboxcart'][$i]["size"]."')";exit;*/
	
	mysql_query("insert into tblcartdetails(cartid,productid,qty,colorindex,UNITPRICE,total,status,itemno,sizes) values('".$cid."',".$_SESSION['sirboxcart'][$i]["productId"].",".$_SESSION['sirboxcart'][$i]["qty"].",'".$_SESSION['sirboxcart'][$i]["color"]."',".$_SESSION['sirboxcart'][$i]["price"].",".$_SESSION['sirboxcart'][$i]["totprice"].",0,".$_SESSION['sirboxcart'][$i]["itemno"].",".$_SESSION['sirboxcart'][$i]["size"].")");
		

	}

	  

		header("Location: finalpayment.php");

	

	}



 

 ?>