i'm a new xampp user.
after instalation i did not changed any of its options or anything else.
i used this code below, but i can't use PHP SESSION.
could you please help me.
CODE:
page1.php
- Code: Select all
<?php
session_start();
echo 'Welcome to page #1';
$_SESSION['favcolor'] = 'green';
$_SESSION['animal'] = 'cat';
$_SESSION['time'] = time();
// Works if session cookie was accepted
echo '<br /><a href="page2.php">page 2</a>';
// Or maybe pass along the session id, if needed
echo '<br /><a href="page2.php?' . SID . '">page 2</a>';
?>
Page2.php
- Code: Select all
<?php
session_start();
echo("Hi, $animal -- <br>Credit: $favcolor $time");
?>
i see this error:
- Code: Select all
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at F:\win--64--1--9tir85\unzipped\xampp\htdocs\www\test\session\page1.php:1) in F:\win--64--1--9tir85\unzipped\xampp\htdocs\www\test\session\page1.php on line 2
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at F:\win--64--1--9tir85\unzipped\xampp\htdocs\www\test\session\page1.php:1) in F:\win--64--1--9tir85\unzipped\xampp\htdocs\www\test\session\page1.php on line 2
Welcome to page #1
page 2
page 2