I am attempting to create a shopping cart. I am trying to learn sessions.
I have a program I took from a tutorial and it does not seem to work. Actually I also took 1 from a book that does not work either.
I can't seem to retrieve a session. Here is the program: (It never counts up when I refresh or submit back to the same program).
<!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>Untitled Document</title>
</head>
<body><form action="test11.php" method="put">
<?Php
session_start();
if(isset($SESSION['views'])){
echo "It exists";
$SESSION['views'] = $SESSION['views']+ 1;
} else {
echo "No got";
$SESSION['views'] = 1;
}
echo "<br>views = ". $_SESSION['views'];
?>
<input name="" type="submit" />
</form>
</body>
</html>
I must not have something set right in the php.ini. In reading the php documentation I cannot see what is set wrong. Here in the ini:
session
Session Support enabled
Registered save handlers files user
Registered serializer handlers php php_binary wddx
Directive Local Value Master Value
session.auto_start Off Off
session.bug_compat_42 Off Off
session.bug_compat_warn On On
session.cache_expire 180 180
session.cache_limiter nocache nocache
session.cookie_domain no value no value
session.cookie_httponly Off Off
session.cookie_lifetime 0 0
session.cookie_path / /
session.cookie_secure Off Off
session.entropy_file no value no value
session.entropy_length 0 0
session.gc_divisor 1000 1000
session.gc_maxlifetime 1440 1440
session.gc_probability 1 1
session.hash_bits_per_character 5 5
session.hash_function 0 0
session.name PHPSESSID PHPSESSID
session.referer_check no value no value
session.save_handler files files
session.save_path C:\DOCUME~1\LANCEA~1\LOCALS~1\Temp\php\session C:\DOCUME~1\LANCEA~1\LOCALS~1\Temp\php\session
session.serialize_handler php php
session.use_cookies On On
session.use_only_cookies Off Off
session.use_trans_sid 0 0
Any help would be greatly appreciated.
TIA