mwhiz
New Member
- Messages
- 8
- Reaction score
- 0
- Points
- 0
Hi,
I transferred my site from another host and everything worked fine so i know my code is not the problem.
It seems as though on this server I cannot write to the $_SESSION variable.
First things first, here is the code for a little test script that i wrote:
You can view this file at http://mwhiz.x10hosting.com/test/session.php.
Try the file yourself, you will see that the session variable is always empty.
Something that I thought of while im writing this is that the old server had php4, and this server has php5, right? Am I using the wrong syntax?
Can anyone help?
I transferred my site from another host and everything worked fine so i know my code is not the problem.
It seems as though on this server I cannot write to the $_SESSION variable.
First things first, here is the code for a little test script that i wrote:
PHP:
<?php session_start();?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Session Test</title>
</head>
<body>
<?php
if ($_POST['session_name'] != "" && isset($_POST['session_name'])) {
$name = $_POST['sessiom_name'];
$value = $_POST['sessiom_value'];
$_SESSION[$name] = $value;
}
?>
<pre>
<?php
echo "Session:\n========\n";
var_dump($_SESSION);
echo "Post:\n=====\n";
var_dump($_POST);
?>
</pre>
<form id="session_test" name="session_test" method="post" action="session.php">
<p>Variable Name:
<input type="text" name="session_name" id="session_name" />
</p>
<p>Variable Value:
<input type="text" name="session_value" id="session_value" />
</p>
<p>
<input type="submit" name="Submit" id="Submit" value="Submit" />
</p>
</form>
</body>
</html>
You can view this file at http://mwhiz.x10hosting.com/test/session.php.
Try the file yourself, you will see that the session variable is always empty.
Something that I thought of while im writing this is that the old server had php4, and this server has php5, right? Am I using the wrong syntax?
Can anyone help?