Hi, Im new in PHP. I try to run the example session php but error, whats happen ?
below this is the scripts :
<?php
session_start();
session_register("count");
$count++;
?>
<html>
<head><title>sample session</title></head>
<body>
<h1>Demo Session</h1>
<?
echo "You have access this page for : $count time";
?>
</body>
</html>Probably register_globals issue. Also, session_register is deprecated way to handle sessions. Try this:
<?php
session_start();
if (!isset($_SESSION['count']))
$_SESSION['count'] = 1;
else
$_SESSION['count']++;
$count = $_SESSION['count'];
?>
<html>
<head><title>sample session</title></head>
<body>
<h1>Demo Session</h1>
<?
echo "You have access this page for : $count time";
?>
</body>
</html>
below this is the scripts :
<?php
session_start();
session_register("count");
$count++;
?>
<html>
<head><title>sample session</title></head>
<body>
<h1>Demo Session</h1>
<?
echo "You have access this page for : $count time";
?>
</body>
</html>Probably register_globals issue. Also, session_register is deprecated way to handle sessions. Try this:
<?php
session_start();
if (!isset($_SESSION['count']))
$_SESSION['count'] = 1;
else
$_SESSION['count']++;
$count = $_SESSION['count'];
?>
<html>
<head><title>sample session</title></head>
<body>
<h1>Demo Session</h1>
<?
echo "You have access this page for : $count time";
?>
</body>
</html>