matuss Posted April 6, 2007 Share Posted April 6, 2007 hi, i have this php code: switch($int_value) { case 1: $_SESSION['test'] = ""; break; case 2: some code in case 2; break; case 3: some code in case 3; break; } the problem is, that $_SESSION['test'] is set to "" anytime, also when $int_value is 2 or 3... in case that $int_value is 2, code for 2 is executed. but problem is, that also code for case 1 is executed, this problem is with $_SESSION variables... strange is, that this problem is only in Mozilla Firefox!! in IE and opera it works normaly and OK... i asked on some forum, they told i can try to contact PHP server admin... many thanks Quote Link to comment Share on other sites More sharing options...
$cripts Posted April 7, 2007 Share Posted April 7, 2007 need to explain ur problem a bit better and u have no default value.... Quote Link to comment Share on other sites More sharing options...
akitchin Posted April 7, 2007 Share Posted April 7, 2007 no PHP issues will ever be as a result of the browser the client uses. the browser is client-side, whereas any PHP issues will be present on the server's side of things. the only client-based cause for session or cookie issues would be if your browser isn't set to allow them. whenever debugging a switch statement for which you can't tell what case is being executed, try running an echo. if the switch() is for some reason in an invisible area of the browser, you can always use javascript to make it in your face: <?php echo '<script type="text/javascript">alert("the integer value is '.$int_value.'.");</script>'; switch ($int_value) { case 1: echo '<script type="text/javascript">alert("case number '.1.' was executed!");</script>'; break; case 2: echo '<script type="text/javascript">alert("case number '.2.' was executed!");</script>'; break; } ?> try running that - it should tell you both what the $int_value is, as well as which case is being executed. could very well be a casting issue (ie. $int_value is actually a string). Quote Link to comment Share on other sites More sharing options...
MadTechie Posted April 7, 2007 Share Posted April 7, 2007 I use firefox as a main browser and use switch and sessions, never had a problem even with IE6&7 or Opera Quote Link to comment Share on other sites More sharing options...
matuss Posted April 7, 2007 Author Share Posted April 7, 2007 really strange thing is, that this problem is only in firefox... if i try to echo something within case, it is not diplayed. only operations with SESSION are executed in case!! also i tried to use if ($int_val == 1) { echo "i am here"; $_SESSION['test'] = ""; } my $_SESSION['test'] variable was erased, even if $int_val was 2...but "I am here" dont appear.. if i use if ($int_val == 1) { echo "i am here"; //$_SESSION['test'] = ""; } everything is ok, no erase of my variable occurs. i dont know what to do, its bad only in firefox Quote Link to comment Share on other sites More sharing options...
MadTechie Posted April 7, 2007 Share Posted April 7, 2007 as a note if session is set in IE it is NOT set in firefox at the same time, write a simple script to trash all your sessions and then test IE, trash them again and then run the exact same test (same order) in firefox just an idea Quote Link to comment Share on other sites More sharing options...
per1os Posted April 7, 2007 Share Posted April 7, 2007 Make sure your privacy settings are the same in both. Really using firefox or IE should not matter to PHP, but the browser settings will. Such as if IE allows cookies and firefox does not. Quote Link to comment Share on other sites More sharing options...
matuss Posted April 7, 2007 Author Share Posted April 7, 2007 cookies in IE and firefox are enabled for sure... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.