Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2004

    Unanswered: Pass Variables from html to thank you page

    I have a standard Registration page that has about 12 fields. When submit is clicked it is processed through a php script, validated an email to me is generated and a mysql db is populated. Then a standard thank you page is called.

    I would like to either pass the variable from the registration page to the thank you page so the user can confirm the data they are submitting OR just pull those variables back out of the db and display them on the thank you page. I have tried many suggestions with PRINT and ECHO and I am having a hard time. Can someone get me on the right track.


  2. #2
    Join Date
    Jan 2004
    If you have the any id or username that is unique the you could just pass the variable alonge with the url like
    header ("location: thanku.php?userid=$userid");

    Then you can fetch the remaining parts form the DB. This could be one of the way.
    Else pass some of the values through url that are relevent or is important to be shown to the user. Hope you know how to get the values from url. You have to use $HTT_GET_VARS[''];

    To display the value you can use print or echo..
    If you have more doubt in this case .. then be little more specific about what exactly you want. I will try to help to with what ever I can..

  3. #3
    Join Date
    Feb 2004
    Your PHP.ini file "register_globals" directive should be set to Off, if it is on then you can access the form variables as globals directly by the form field name, otherwise you have to use PHP Variables to access from the POST or GET mothod the form. PHP provides the Global variables $HTTP_GET_VARS or $HTTP_POST_VARS to hold your form values. These associative arrays contain the name/value pairs submitted by your form. You should already be accessing these arrays to get the data to your database.

    Put this near the top of your script on the confirmation PHP. This will set a variable with your name/values whether Get or Post method is used.
    $PARAMS = ( count( $HTTP_POST_VARS ) )
                 ? $HTTP_POST_VARS  : $HTTP_GET_VARS;
    You can then use the variables in your script by referring to the $PARAMS array like this. Assuming you have fields in your form of 'fristname', 'lastname', 'address'.
    print $PARAMS['firstname'];
    print $PARAMS['lastname'];
    print $PARAMS['address'];
    The form GET Method will pass the forms name/values appended to the URL string. This can help with testing and developing to see the variables. The POST method passes the variables hidden from view.

    Check this URL for PHP Forms Intro.
    Last edited by savbill; 10-04-04 at 11:17.


  4. #4
    Join Date
    Oct 2004
    Manchester, UK.
    As the Form Variables are passed through the PHP Script set them into the Users Session and when the User arrives at the Thankyou Page simply Echo them out to the screen...

    HTML Code:
    <form name="form1" method="post" action="phpscript.php">
    <input type="text" name="customername">
    PHP Code:
    PHP Code:
    echo $_SESSION['customername'];
    Last edited by; 10-21-04 at 07:23.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts