Copy link to clipboard
Copied
Session not working in IIS or WAMP using PHP, MySQL, Webassist and Dreamweaver on localhost . All pages were developer months ago and are working on GoDaddy server. All five websites are no-longer recording the data from Store Result. Evenwrote a test page. Get this message "
Notice: Undefined variable: ok in C:\wampserver64\www\lccc\A_SESSION TEST.php on line 12
session FAILED". Been trying to selove for a month. Can anyone help. [personal info removed by moderator]
<?php
session_start();
?>
<!doctype html>
<html >
<head>
<meta charset="UTF-8">
<title>Test</title>
</head>
<body>
<?php
echo $ok ? 'session OK' : 'session FAILED';
?>
</body>
</html>
Copy link to clipboard
Copied
Where are you getting the $ok variable from? The error is saying the variable $ok can't be found as its not been set in the code available and therefore cant check if a session is active so its returning failed.
You're usually checking a condition like:
$ok = 20;
echo $ok > 10 ? 'session OK' : 'session FAILED';
But I dont know what the variable $ok is?
Copy link to clipboard
Copied
Which version of PHP is installed on your local server?
Which version of PHP is installed on GoDaddy's server?
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>PHP Test</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<?php phpinfo() ?>
</body>
</html>
Ideally both server's should be using the same set-up.
Copy link to clipboard
Copied
Could you give us a link to one of the 5 websites so that we can see what is going on.