I'm having problems keeping a variable I need across multiple pages. I'm making a simple web for where I work that is comprised of 8 html pages containing forms. The reason why 8 seperate pages are needed is to break it down into easy to manage components for both myself and users. After the user enters information on the first page(using form fields such as pull down menus and text fields), that data is sent to a php script(on another file) using the POST method. That php code then writes the post data to a database. After running the php section in that file, the <body> tag of the HTML section uses the "onload" attribute to bring the user to the next page so that more information can be written. This process of brining up an html form page to enter data, followed by writing the data to a database with PHP, then bringing up another html form page, continues until the final page. But it doesn't work. After it finishes writing the second page and calls up the 3rd to enter data,it appears to loose the session and the session variable no longer has its value. The 3rd page, and all after don't write anything because the value of the primary key is not kept. I have verified this by no loading the rest of the pages and working page by page.
So, why is my sesion being dropped after the 3rd time its called? Is there an easier way to store a variable that has to be accessed across multiple php pages without using sessions? I thought about using a hidden field in the <FORM> section, but it will not work to suit my needs. I'm new at session so feel free to add any additional help that I might find usefull.
I'm not a programmer and this is the first I've used PHP, so if my method sounds difficult or confusing, feel free to recommend something better. From what I've read so far, this sounded like the easiest way to accomplish this. Sessions appear not to be working as my book or any web texts describe.
Thanks for all your help.
Ben