FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

PHP Sessions Issue

 


akshar
I have a following code
Code:

<?php session_start();?>
<html>
<head>
<script src="something.php" language =javascript></script>
........
<body>
<?php
$_SESSION['user']="hello";
?>
Code to refresh the page


in something.php which actually renders a javascript
Code:

<?
if($_SESSION['user')
{
echo "alert('valid')";
}
else
{
echo "alert('invalid');
}


on one machine I get promt as valid and on one machine I get it as invalid. Do u know the reason?
Peterssidan
You have forgot a ] at
Code:
if($_SESSION['user')
rvec
and you shouldn't forget the session_start(); on every page that uses sessions, not only the one on which it starts.

You should think of session_start(); as a command to start session handling, not a command to start a session.
akshar
well sorry for typo mistakes
however my problem got solved when i used meta tag fr disabling cache
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.