note 51091 deleted from function.session-register by philip
| From: | philip@php.net | Date: | Wed, 29 Mar 2006 06:25:31 +0000 |
| Subject: | note 51091 deleted from function.session-register by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-106918@lists.php.net to get a copy of this message | ||
Note Submitter: mantas at systemnetwork dot net
----
I have 3 files:
- The first is the form that contains various fields.
- Second is the php script that the form submits data to. This file then stores acquired values to
the session.
- Finally the third file is the php script that accesses data from the session
So the first script:
<?
session_start();
$title = $_POST["title"];
$fname = $_POST["fname"];
$_SESSION["first"] = $fname;
?>
... All we do here is set values from HTTP POST request.
Now the second script:
<?
session_start();
echo $_SESSION["first"];
?>
... Here we try to print out the session variable that was set in the previous script.
This demonstrates the use of $_SESSION. There is no need to declare $_SESSION to be global since it
is already global, thus can be accessed from anywhere.
Tested on PHP 4.