Forum Moderators: coopster
I want to set this parameter to 0 when there is no search,
so I used this:
(this is done in an included file that runs before anything else and is responsible for sessions, initializing and such)
if(!$_GET["s"])
{
$_SESSION["search_parameters"] = 0;
}
I encountered a problem that happens in IE but doesn’t happen in Opera.
When I refresh the search-results page, for some reason the $_SESSION["search_parameters"] was set to 0,
although it shouldn’t have.
Trying to find the problem I changed the code a bit
if(!$_GET["s"])
{
$_SESSION["search_parameters"] = 0;
?>
<script language="JavaScript" type="text/javascript">
alert('something');
</script>
<?
}
There where 2 interesting results to this test
1) there was no alert where there shouldn’t be an alert, so I still don’t know what set the session var to 0.
2) At other pages I got 2 alerts (!) instead of the expected 1, and it happened in IE only!
Anyone has any idea?
I have printed the content of the $_SESSION at the top of the page, and the field was set to 0 by then
way before this bit of code.
I have two points to add.
When I remove the line "<meta http-equiv="content-type" content="text/html; charset=UTF-8">"
there was only one alert, and not two, and to be more accurate, it was enough to remove the "chareset=UTF-8" part,
any possible explanation?
I created a page which doesn’t do anything but print the $_SESSION
and used the "open in new window" to open it, so now I have the troublesome page and the test page both opened
and both with the same session
and here is the weird thing, in the subject page I print the $_SESSION at the top and at the bottom of the page,
both are ok
when I refresh the test-page, the search-parameters field is set to 0
where I now refresh the subject page the search-parameter is set to 0 as well
when could it be set to 0 if the last action was displaying a correct session?