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; ?> 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; Link to comment https://forums.phpfreaks.com/topic/192742-php-sessions-arrays/#findComment-1015323 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.