Hello
I understand how to write to cookies and reuse the information later in my website. Now I want to try and write a simple shopping basket. What I need to do is(i think)is store an mysql table name and a prodrot id in the cookie then increment a counter. then when if someone clicks a link it stores the next mysql table and product id will be stored. First how do i store more than one varable in a cookie? shall i set it up as an array? (this is why i think I need a counter🙂)
so the first link will look like this
:-
<a href="basket.php?id=1&table=game=count=1">Game 1</a>
then after one click it needs to go to this
<a href="basket.php?id=4&table=oldgame=count=2">Game 4</a>
I can write a single varable to a cookie like this: -
<?php
if ($colour != null)
{
setcookie ( "fontcolour", $colour, time()+2592000 );
}
?>
<html>
<head>
<title>Set Cookie</title>
</head>
<body>
<a href="setcookie.php?colour=ff0000">Red</a><br>
<a href="setcookie.php?colour=00ff00">Green</a><br>
<a href="setcookie.php?colour=0000ff">Blue</a>
<br><br>
<?php echo($colour); ?>
<br><br>
<a href="getcookie.php">click here to conutine</a>
</body>
</html>
Thanks in advance 🙂