RE: [PHP] PHP Sessions?
| From: | Chris W. Parker | Date: | Wed, 02 Mar 2005 22:59:17 +0000 |
| Subject: | RE: [PHP] PHP Sessions? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-209874@lists.php.net to get a copy of this message | ||
rory walsh <mailto:rorywalsh@ear.ie>
on Wednesday, March 02, 2005 2:38 PM said:
> Is it to do with the link:
> <a href=\"index.php?action=edit\">
> does this call the script again, just as an action="script.php" in a
> form would? Cheers for the help on this.
Yes it does. But it doesn't erase the session values (it seems that's
what you think is happening?).
I think what you need to do (I do this sometimes too) is start from
scratch and create a very basic test page that works as expected. Then
slowly add in the features you want. It'll give you a much greater
understanding of how things work and where you're going wrong. Sure it's
tedious but it'll help you in the long run.
Here is a good base to start with:
<?php
session_start();
if(isset($_GET['var']) && !empty($_GET['var']))
{
$_SESSION['myVariable'] = "from form";
}
else
{
$_SESSION['myVariable'] = "direct request";
}
print_r($_SESSION);
?>
hth,
Chris.