Before you can store user information in your PHP session, you must
first start up the session.
Note: The session_start() function must appear BEFORE the <html> tag.
<?php
session_start();
// store session data
$_SESSION['views']=1;
?>
<html>
<body>
<?php
//retrieve session data
echo "Pageviews=". $_SESSION['views'];
?>
</body>
</html>
<?php
<?php
Note: The session_start() function must appear BEFORE the <html> tag.
<?php
session_start();
// store session data
$_SESSION['views']=1;
?>
<html>
<body>
<?php
//retrieve session data
echo "Pageviews=". $_SESSION['views'];
?>
</body>
</html>
Comments
Post a Comment