PHP variables carried across pages

I’ve got a PHP question. Here’s the scenario:

HTML page with a form. User submits. Loads PHP page which grabs form contents via $_POST[]. There’s also another form on this second page. User fills it out and submits second page which takes them to a third page (which then enters everything into a db. I need the $_POST[] variables from the form the user filled out on the first HTML page to be accessible to me on that third page so I can write them to the db once I’ve validated the entries on the second page. Does this make sense? How can I carry those $_POST variables across pages?


Store all the submitted data in session variables after validation. What you’re receiving as $_POST[‘name’] can be stored in $_SESSION[‘name’] and accessed the same way, except it will persist across multiple page loads and form submittals.

PHP session documentation

If you want useful replies, ask smart questions.


Oddly enough, I demonstrate the use of session variables in a post I made today, although it was a database-specific question: Help with SQL

Simon Jessey
Keystone Websites | si-blog

Excellent. That post makes perfect sense.

I scripted something up quickly and it works just like I need it to.