jej07
asked on
Help avoiding duplicates when adding to PHP Session
When trying to add one or more arrays to my Session array, I run into a problem where the added array is duplicated on a page reload. I've tried a few different things to avoid this, but can not seem to find the solution.
Is it possible to somehow count how many times the page has been refreshed so that $discountedItems is only added once to the Session, regardless of how many times the page get's refreshed?
Is it possible to somehow count how many times the page has been refreshed so that $discountedItems is only added once to the Session, regardless of how many times the page get's refreshed?
$discountedItems = array(
'name' => 'discount',
'quantity' => '1',
'price' => '-35.00',
);
array_push($_SESSION['items'],$discountedItems);
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.