Hi,
i want to create cookies in my shopping cart site. I want when i click on add to cart button of
this product. the information of the product save in cookies and destroy when user close his browser.
I want a script. When i create cookies it's work only for one time after reload or refresh the page
the nulled cookies generate automatically and my product information replace with null information.
here are my code.
<?php
error_reporting(E_ALL ^ E_NOTICE);
include("connection.php");
setcookie('pro_id', $_REQUEST['pro_id']);
setcookie('pro_id', $_REQUEST['pro_id'], time()+3600);
setcookie('title', $_REQUEST['title']);
$pro_id = $_COOKIE['pro_id'];
$title = $_COOKIE['title'];
$Special_Product_Sql = "SELECT * FROM product WHERE status = 1 && featured = 1";
$Special_Product_Exe = mysql_query($Special_Product_Sql);
while($Product_Fetch = mysql_fetch_array($Special_Product_Exe)) {
$path = 'product/'. $Product_Fetch['product_img'];
?>
<form method="get" action="<?php echo $_SERVER['PHP_SELF']?>" onsubmit="storeValues(form)" name="form">
<input type="hidden" value="<?php echo $Product_Fetch['pro_id']; ?>" name="pro_id">
<input type="hidden" value="<?php echo $Product_Fetch['title']; ?>" name="title">
<input type="hidden" value="<?php echo $Product_Fetch['description']; ?>" name="field3">
<input type="hidden" value="<?php echo $Product_Fetch['cat_id']; ?>" name="field4">
<input type="submit" title="Add to Cart" value="Add to Cart" class="addtocart_button_module">
</form>
<?php }; ?>
waqar3 0 Newbie Poster
diafol
waqar3 0 Newbie Poster
diafol
waqar3 0 Newbie Poster
diafol
waqar3 0 Newbie Poster
diafol
Ponypeet 0 Newbie Poster
waqar3 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.