Recording form variables

Posted on 2006-05-26
Last Modified: 2008-03-06
I've got three forms with lots of fields on them. What happens is the visitor fills out form one, then two, then when the third one is submitted it will fire an email off with all the data that has been submitted.

So, I have to pass the data between forms and I was just about to create a hidden field in form2 for all the variables passed from form1 when I thought "This is bonkers, there are about 30 of them, there must be an easier way?".

Is there an easier way?
Question by:andycal
    LVL 49

    Expert Comment

    You can try and use sessions. That would be the easiest way to go.

    LVL 16

    Accepted Solution

    sessions is a very good thing to do, here is a sample code
    foreach ($_POST as $key => $value){

    // retreval of stored form variables
    foreach ($_SESSION['formVariables'] as $key => $value){
    echo "$key = $value<br>";

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    As this topic comes over and over again in different forms, I've finally decided to write a short (yea, right...) article / tutorial about pagination with PHP with MySQL database. There are dozens of these kind of tutorials, I know - I wanted to mak…
    Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
    The viewer will learn how to dynamically set the form action using jQuery.
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now