John Taylor-Johnston wrote:
Jason wrote:
RTFM again.

Jason, again, I RTFM, but did not get it working.
Otherwise I wouldn't have dared ask a question.

Sessions depends on a number of factors
including your version of PHP and the setting of register_globals.

The FM manual says:

"$_SESSION (or $HTTP_SESSION_VARS with PHP 4.0.6 or less) is recommended"

So I am using "PHP Version 4.1.2" (and "4.2.3" on my localhost to test offline)

Ok. I quit using $HTTP_POST_VARS["familyname"].

With a little rethinking, I have this working, I hope.

Now ... is there a cleaner way to assign my variable "familyname"?

Pseudo code:

if _post["familyname"] exists set session variable
                 (no sense in setting it until I post it)
if _session["familyname"] exists, $familyname = $_SESSION["familyname"];

I'll have about 30 variables. Going to be alot of lines. There must be an easier, cleaner way?


if (isset($_POST["familyname"]))
$familyname = $_POST["familyname"];
echo "Yay: \$familyname= $familyname<br>";

if (isset($_SESSION["familyname"]))
$familyname = $_SESSION["familyname"];
echo "yay session works, \$familyname= $familyname<br>";

Hey, I dont know how much easier it will be but it is faster, you could use a switch statement.

switch ($_SESSION['familyname'])
case 'name1':
do something;

case 'name2':
do something;

do this if the variable doesnt match a case;

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to