php - Store bidimensional array from Javascript in Cookie -
first of all, that's reading , trying me!
i got online shop , have bi-dimensional array products that:
1. $arrayproducts[id][0] -> id 2. $arrayproducts[id][1] -> product name 3. $arrayproducts[id][2] -> price
etc..
i know isn't best way system, it's done that.
now, want store bi-dimensional array in cookie, because want store cart user if go away page, , load again when come back.
i think best way cookie, don't know if should json_encode
, json_decode
bi-dimensional array, or best way fix problem.
before saving data cookie stringify array.
var x = json.stringify(yourarrayvar);
then save x in cookie.
Comments
Post a Comment