Jump to content

sessions


raptor30506090

Recommended Posts

Hi guys and girls

 

Just a quick question just to get me started with my problem.

 

Can any one point me in the right direction how to use form options with session im trying to build a shopping cart with size options with diffrent prices how do i go about this, if some one add to cart option 1 at 1.99 and then add option 2 at 2.99 how do i get this to work in a session

 

Many thanks Daz

 

or if you now of any website that mite be usful that also would be great

Link to comment
Share on other sites

here is one im stuck on

 


if(isset($_GET['add'])){
                  $cart = 'cart_';
                  if(isset($_SESSION[$cart . (int)$_GET['add']])){
	                                  $_SESSION[$cart . (int)$_GET['add']] ++;
									  }else{
										   $_SESSION[$cart . (int)$_GET['add']] = '1';
										   }

 

is this the ideal way to do session check and how do i stop it from adding to cart on the refresh

 

many thanks Daz

Link to comment
Share on other sites

What you could do is add a sort of captcha to the link. A random string of characters that will be kept in a session and regenerated every page load. That way people will be able to add more than one of the same item and it won't re-add an item if you reload the page.

Link to comment
Share on other sites

Yeah, the random string of characters is generated on the first visit to the page, then it's regenerated every time the user adds an item to the basket. If they're attempted to use the code from the previous page load the add will fail. However the links will use the new code that's saved to the session.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.