shopping cart problem

F

fiona

Be grateful if someone could help me out with this.
I'm working on a shopping cart where I want the choice of adding four
different items to it
What's happining at the moment is when I add something from the top box
named productid id it adds the item to the cookie.
when I try to add something from any other "productid" it still adds
the
first item quantity to the cart
Now, I imagine this is because I have the variables all named the
same, but
I don't know how to change it do i add in
four variables in place of the "id" variable now?

Thanks for any help



function setCookie1()
{
alert("Setting the cookie");
alert("Quantity:"+document.purchaseForm.priceText.value);
// var id = prompt("What's your product ID?","");

//var qty = prompt("What's the quantity?", "");

id = document.purchaseForm.productId.value;
qty = document.purchaseForm.priceText.value;
var previousCookie= document.cookie; //retrieve cookies held

var previousData = unescape(previousCookie);

var newData = id +":" + qty;
newData = newData+"/"+previousData;

var cookie1 = escape(newData);

document.cookie = cookie1;

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,992
Messages
2,570,220
Members
46,807
Latest member
ryef

Latest Threads

Top