Hello!
I have two files. index.php calling action.php from a html form.
index.php
************
<html>
<body>
<?php
session_start();
if (!isset($_SESSION['s'])) {
$_SESSION['s'] = 'test';
}
session_write_close();
?>
<form action="action.php" method="post">
<p>Your name: <input type="text" name="name" /></p>
<p>Your age: <input type="text" name="age" /></p>
<p><input type="submit" /></p>
</form>
</html>
</body>
action.php
*************
<html>
<body>
<?php
session_start();
echo $_SESSION['s'];
?>.
Hi <?php echo $_SESSION['name']; ?>.
You are <?php echo $_POST['age']; ?> years old!
</body>
</html>
Calling the session_start(); function causes this message and the action.php never recives the session s:
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /usr/local/apache2/index.php:4) in /usr/local/apache2/index.php on line 5
What is wrong?
Thank you.
Can not get sessions to work.
Moderator: General Moderators
-
Mattias1975
- Forum Newbie
- Posts: 1
- Joined: Thu Jan 20, 2005 11:44 am