RE: [PHP] Working with sessions
| From: | Jay Blanchard | Date: | Fri, 21 Sep 2007 18:26:35 +0000 |
| Subject: | RE: [PHP] Working with sessions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-262346@lists.php.net to get a copy of this message | ||
[snip]
I have a question about sessions, I am attempting to store a search
term in a session variable to that when it finds the set of records
from the database it can export it to excel. The problem I have is
that the session variable is 1 search behind...
[/snip]
When you do the search store the search term immediately to the session
variable;
<?php
//pseudo-code
start_session();
$_SESSION['searchTerm'] = $_GET['searchTerm'];
?>
<html>
<a href="link to excel sheet">
</html>
Now in the code that generates the excel;
<?php
session_start();
$getStuffForExcel = "SELECT foo, bar FROM data where foo =
'".$_SESSION['searchTerm']."' ";
?>