Sessions

From: Date: Mon, 03 Feb 2003 18:06:07 +0000
Subject: Sessions
Groups: php.general 
Request: Send a blank email to php-general+get-134154@lists.php.net to get a copy of this message
In an earlier post I wanted to carry an id number that I had in $HTTP_GET_VARS into another script. I was told that one way would be to store the number in the session. My question is how can I store a variable inside a session? In my books and in the documentation I see things about the global $_SESSION array, and see examples using $_SESSION['visits'], but where can I store the value of something like the id number of a record in a database. What I have is a page that lists records in a database. In this case it happens to be an asset database. I have a hypertext link for the asset_id. I click on the link and it adds the id number to the url like this: <td align=\"left\"><a href=\"editsoftwareasset.php?id=$row[asset_id]\">$row[asset_id]</a></td> I then use $HTTP_GET_VARS to get the record's information and fill in the fields in editsoftwareasset.php so that I can edit the information. $query = "select * from assets where asset_id = '$HTTP_GET_VARS[id]'"; I am stuck when I go to save the information because I can't get the $HTTP_GET_VARS to to carry onto the script for processing the changed information. One way I could do it is with a hidden field, but I would like to do it within sessions. How can I store the asset_id in the session? Thanks, Mike

« previous php.general (#134154) next »