When I set the variable gquery in this function
<?
session_start();
session_register("gquery");
function showquery() {
?>
<CENTER>
<FORM ACTION="<?=$PHP_SELF?>" METHOD="Post">
Search:<INPUT TYPE=text NAME=gquery VALUE="<?echo $gquery ?>">
<INPUT TYPE="submit" VALUE="search">
</FORM></CENTER>
<?
}
In the code fragment:
if(!isset($gquery)) {
showquery();
}else
{
showquery();
echo "gquery=$gquery<BR>";
}
Once show query is called the value of $gquery should be overwritten but instead, $gquery stays the same until I unset the session variable? can a session variable only be written to once? Is the the wrong way to handle a persistent variable?
I have even tried passing the variable to the function showquery and getting gquery from a returned local variable, but that returns nothing each time.