RE: [PHP] Working with sessions
| From: | Jay Blanchard | Date: | Fri, 21 Sep 2007 18:35:40 +0000 |
| Subject: | RE: [PHP] Working with sessions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-262348@lists.php.net to get a copy of this message | ||
[snip]
Wouldn't that be what this code does:
<?PHP
if ($_SESSION['search'] != NULL){
echo "The search string is: <strong>$search</strong>.<BR>";
$qrow[]= mysql_query($qstring) or die(mysql_error());
$qresult = $qrow[0];
$num_rows = mysql_num_rows($qresult);
//display search form
echo "
<form action='search.php' method='GET'>
<label>Search:
<input type='text' name='search' id='search' />
</label>
<input type='submit' value='Go!' />
</form>";
$_SESSION['search'] = $_GET['search'];
?>
[/snip]
Looks like it should if the form is referring to PHP_SELF (search.php).
Do you have a seesion_start() at the top of the page?