I’m running PHP5 and IIS6. I have created a simple login script which verifies account details entered into a form against a DB and then if successful creates a number of session variables. Browsing through other pages within the site (and once logged in) the session variables are available (as they should be) and everything seems to work fine.
The problem:
If I create a page that contains a form and the form is submitted, the session variables suddenly become unset i.e. the session is being destroyed. I am relatively new to PHP but have absolutely no idea why this is happening. Is anyone able to help?
It’s worth mentioning the way in which the site works. All content is pulled into index.php depending on the value of variable ‘p’ e.g. www.mysite.com/index.php?p=1 – index.php would go to the DB find the correct reference to the content with an id of 1 and include it:
<?php
//start session
session_start();
//connect to the database
include 'db_connect.php';
//html header stuff comes here
//page requested
include '$p_whatever_it_might_be';
include ‘footer.php’;
?>