Jump to content

php sessions arrays


paul2010

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.