note 51091 added to function.session-register

From: Date: Sat, 19 Mar 2005 11:40:01 +0000
Subject: note 51091 added to function.session-register
Groups: php.notes 
Request: Send a blank email to php-notes+get-86684@lists.php.net to get a copy of this message
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. ---- Manual Page -- http://www.php.net/manual/en/function.session-register.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+51091 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51091&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51091&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51091&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51091&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51091&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+51091&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#86684) next »