php - Session Array not working -


so i'm creating array in session reason when try add stuff it, no longer array. i'm not sure happening.

adding item

if(!isset($_session['printsid']) && !isset($_session['printsnum'])){     $_session['printsid']=array();     array_push($_session['printsid'],$_get['itm']);     $_session['printsnum']=array();     array_push($_session['printsnum'],$_get['num']);     header('location: google.com'); } else{     array_push($_session['printsid'],$_get['itm']);     array_push($_session['printsnum'],$_get['num']);     header('location: http://www.repmofbla.com/simmonsredone/');     } 

getting item

if(isset($_session['printsnum'])){        $cartitems = array_sum($_session['printsnum']);          $cartitems += sizeof($_session['artwork']); }  else{      $cartitems = sizeof($_session['artwork']); } 

any great. thank guys :)

(i'm not best php know there more efficient way this. respect please)

more details: parts on different pages. what's weird when first upload script works. use add script quits working , array's no longer "exist", if reupload script works again. it's weirdest thing i've ever encountered.

that's because, trying redirect different domain. redirecting different domain doesn't carry session forward.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -