<!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>
	<title>A Simple Lightweight jQuery Modal Popup Box.</title>
	<script src="jquery.min.js" type="text/javascript"></script>
	<link href="modalPopLite.css" rel="stylesheet" type="text/css" />
	<script src="modalPopLite.js" type="text/javascript"></script>

	<style type="text/css">
		/* CSS Reset */  
		#clicker
		{
			font-size:20px;
			cursor:pointer;
		}
		#popup-wrapper
		{
			width:500px;
			height:300px;
			background-color:#ccc;
			padding:10px;
		
		}
	</style>

	<script type="text/javascript">
		$(function () {
		    $('#popup-wrapper').modalPopLite({ openButton: '#clicker', closeButton: '#close-btn', isModal: true });
		});
	</script>
</head>



<?php

include("connect.php");

session_start();

if(isset($_SESSION['loginuser-id'])) {
	
	$s_id1 =$_SESSION['loginuser-id'];
	}
	else {
       $s_id1 =session_id();
	   
	   
	}
if(isset($_POST['submit']))
{
include("connect.php");

$id=$_POST['hidden'];
echo $id;

$quantity=$_POST['c_quantity'];


$sql1="select * from product where p_id='$id'";

$result=mysql_query($sql1) or die(mysql_error());

while($row=mysql_fetch_array($result))
{

$p_id=$row['p_id'];
$p_name=$row['p_name'];

echo $p_name;

$p_img=$row['p_img'];

echo $p_img;
$p_price=$row['p_price'];

echo $p_price;


}

$sql2="insert into mycart(c_name,c_price,c_img,c_s_id,c_quantity,c_p_id,order_id)values('$p_name','$p_price','$p_img','$s_id1','$quantity','$p_id','$s_id1')";

echo $sql2;
mysql_query($sql2) or die (mysql_error());


header("Location:viewcart.php");

}

?>