Re: How PHP recover value from another frame?
| From: | John Taylor-Johnston | Date: | Thu, 06 Mar 2003 07:01:00 +0000 |
| Subject: | Re: How PHP recover value from another frame? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-138424@lists.php.net to get a copy of this message | ||
You are going to need to start a session.
http://www.php.net/manual/en/ref.session.php
http://www.php.net/manual/en/function.session-start.php
The idea was to see if $variable was in the session. If it was, use the session variable. I was
passing a lot of variables through <input type=hidden> before this, until I learned about
sessions.
This will get you started. I had a lot of variables, so I used a function.
<?php
#session_name("TestALS");//not necessary
session_start();
$studentid = getvar('studentid');
$idconfirm = getvar('idconfirm');
$familyname = getvar('familyname');
$firstname = getvar('firstname');
$sessionselected = getvar('sessionselected');
$homefac = getvar('homefac');
function getvar ($varname)
{
global $debug;
if (isset ($_POST[$varname]))
{
$_SESSION[$varname] = $_POST[$varname];
# echo "\$gdebug $debug<br>";
if ($debug == "on"){
echo "_post $varname $_POST[$varname]<br>";
echo "_session0 $varname $_SESSION[$varname]<br>";
}
return $_POST[$varname];
}
elseif (isset ($_SESSION[$varname]))
{
# echo "\$hdebug $debug<br>";
if ($debug == "on"){
echo "_SESSION $varname $_SESSION[$varname]<br>";
}
return $_SESSION[$varname];
}
}
...
?>