I'm having trouble saving data to a variable in PHP.
I have XAMPP set up on my laptop and the following code works on my machine (going to localhost), but doesnt work on my webhost (gradwell). I've doubled checked using PHPinfo that sessions are enabled on the host and they are. Unfortunately I cannot get to any error logs due to it being a remote host. Can anyone shed some light into this? many thanks
page 1
<?php
session_start(); // NEVER forget this!
$_SESSION['test'] = "donkey"; // store session data
echo "sending var to next page. currently our test var is : ". $_SESSION['test']; //retrieve data
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
<a href="test2.php">Go!</a>
</body>
</html>
page 2:
<?php
session_start(); // NEVER forget this!
echo "now we're on the second page, and our test var is : ". $_SESSION['test']; //retrieve data
?>
Question
Ecion
Hi all,
I'm having trouble saving data to a variable in PHP.
I have XAMPP set up on my laptop and the following code works on my machine (going to localhost), but doesnt work on my webhost (gradwell). I've doubled checked using PHPinfo that sessions are enabled on the host and they are. Unfortunately I cannot get to any error logs due to it being a remote host. Can anyone shed some light into this? many thanks
page 1
page 2:
Link to comment
Share on other sites
4 answers to this question
Recommended Posts