note 30027 added to function.session-register
| From: | johannes at rack1 dot php dot net | Date: | Tue, 04 Mar 2003 16:04:07 +0000 |
| Subject: | note 30027 added to function.session-register | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-44832@lists.php.net to get a copy of this message | ||
If you want to use sessions in php 4.30 and globals OFF
And you want to create a dynamic array.
<?php session_start(); ?>
<html>
<head>
<title>Untitled</title>
</head>
<body>
<?php
if (isset($_GET['table'])){
if (isset($_SESSION['job_info'])){// check if it exsist one session named
"job_info"
$job_info =$_GET['table'];
array_push ($_SESSION['job_info'],$job_info);//add new data to the array
}
else{
$job_info[] =$_GET['table'];
$_SESSION['job_info']=$job_info;//create new array
}
$i = count ($_SESSION['job_info']);
$i--;
for(;$i>=0;$i--){
echo $_SESSION['job_info'][$i];//prints all aray data
}
}
?>
<br><a href="session_global_off.php?table=data">new array data</a>
</body>
</html>
--
http://www.php.net/manual/en/function.session-register.php
http://master.php.net/manage/user-notes.php?action=edit+30027
http://master.php.net/manage/user-notes.php?action=delete+30027
http://master.php.net/manage/user-notes.php?action=reject+30027