Re: Session confusion again :( - Thanks!
| From: | BOOT | Date: | Wed, 14 Apr 2004 19:36:40 +0000 |
| Subject: | Re: Session confusion again :( - Thanks! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-183371@lists.php.net to get a copy of this message | ||
But if I want to use $username accross many pages then I will have to make
it a session variable and call it as such on each page like
"$_SESSION['username']"
Thanks again!
"Chris W. Parker" <cparker@swatgear.com> wrote in message
news:001BD19C96E6E64E8750D72C2EA0ECEE2B88E7@ati-ex-01.ati.local...
BOOT <mailto:pfine@of-law.com>
on Wednesday, April 14, 2004 12:17 PM said:
> So I went and turned them off. Now of course my pages don't work
> properly. I guess I have to go through all my code and address the
> variables properly ie. $_POST and $_SESSION?
no.
just assign them at the beginning of your file.
CURRENT FILE:
<?php
echo "$username is logged in!!";
echo "hello $username, you are logged in.";
?>
WHAT I THINK YOU WOULD CHANGE IT TO:
<?php
echo "{$_GET['username']} is logged in!!";
echo "hello {$_GET['username']}, you are logged in.";
?>
WHAT YOU SHOULD DO INSTEAD:
<?php
$username = $_GET['username'];
echo "$username is logged in!!";
echo "hello $username, you are logged in.";
?>
of course. don't forget to validate your incoming data.
hth,
chris.