Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Data Access, Manipulation & Batch Languages > PHP > Pass Variables from html to thank you page

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-03-04, 01:16
gmead7260 gmead7260 is offline
Registered User
 
Join Date: Oct 2004
Posts: 1
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.


Thanks,
gary
Reply With Quote
  #2 (permalink)  
Old 10-04-04, 04:40
rajesh_r_r rajesh_r_r is offline
Registered User
 
Join Date: Jan 2004
Location: India
Posts: 168
If you have the any id or username that is unique the you could just pass the variable alonge with the url like
eg:
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..
Regards
Rajesh
Reply With Quote
  #3 (permalink)  
Old 10-04-04, 11:14
savbill savbill is offline
Registered User
 
Join Date: Feb 2004
Posts: 525
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.
Code:
$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'.
Code:
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.
http://www.informit.com/articles/art...=29587&redir=1
__________________
~

Bill

Last edited by savbill : 10-04-04 at 11:17.
Reply With Quote
  #4 (permalink)  
Old 10-20-04, 20:34
Tylmail.com Tylmail.com is offline
Registered User
 
Join Date: Oct 2004
Location: Manchester, UK.
Posts: 3
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...

form.html
*******
HTML Code:
<form name="form1" method="post" action="phpscript.php"> <input type="text" name="customername"> </form>

phpscript.php
***********
PHP Code:
<?php
if($_POST['customername'])
{
session_name();
session_start();
$_SESSION['customername']=$_POST['customername'];
}
?>

thankyou.php
**********
PHP Code:
<?php
echo $_SESSION['customername'];
?>

Last edited by Tylmail.com : 10-21-04 at 07:23.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On