paul2010 Posted February 20, 2010 Share Posted February 20, 2010 I'm trying to make an array which is stored in a session, the array can then be extracted from the session and more elements can be added to the array. Here is what i have so far.. if someone could help me as to where i am going wrong it would be appreciated thanks <?php session_start(); $id = $_GET['ncd']; if(isset($_SESSION['a'])) { $narray = $_SESSION['a']; } $narray = array(); array_push($narray, $id); $_SESSION['a'] = $narray; echo $narray; ?> Quote Link to comment https://forums.phpfreaks.com/topic/192742-php-sessions-arrays/ Share on other sites More sharing options...
sader Posted February 20, 2010 Share Posted February 20, 2010 session_start(); if(!isset($_SESSION['a'])) { $_SESSION['a'] = array(); } $id = intval($_GET['ncd']); $_SESSION['a'][] = $id; Quote Link to comment https://forums.phpfreaks.com/topic/192742-php-sessions-arrays/#findComment-1015323 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.