Since you're going to use sessions, here's a very quick tutorial. Luckily, sessions are one of the easiest things you could want to learn:
1. For some complicated reasons, sessions need to be activated before there is any output (even a single new line) sent to the browser. Also, they should be used on all pages (even if you're not actively using them) for consistency and to keep the session active during the visit to your site. So, just add the following code to the very top of all of your pages:
PHP Code:
<?php session_start(); ?>
2. Once sessions are active, you can use the array $_SESSION to store any information you'd like, any time, on any page, and it will remain active throughout your entire site during the single session for that user. Here's some example code:
PHP Code:
<?php
$_SESSION['myvariable'] = 'Hello!';
//a while later, or on another page:
echo $_SESSION['myvariable']; //print out "Hello!"
?>
Note: sessions are secure, or at least the data is. No one else can access the data stored in the session, and even the user cannot (as they could with a cookie) unless you choose to output it for them.
Of course you'll need to learn a little more about PHP to deal with things like creating a list of pages they've visited and displaying it in a nice format, but that's really all you need to know about sessions (at least for now).
One very basic point: PHP is basically the same thing as HTML, but it does require that your server has PHP installed and enabled-- most do. Then you need to use the .php extension instead of .html so that the server knows to go through the PHP code. But aside from that, .php is functionally the same as HTML-- what the browser sees is the same as an HTML page (it IS an HTML page, actually). So, for example, you could just rename any HTML page on your site .php and it would be fine. (There's no need unless you want to use PHP on it, though.)
Bookmarks