Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTTP_POST_VARS Help 1

Status
Not open for further replies.

deecee

Technical User
Aug 25, 2001
1,678
US
I have a form called "register" that i have set to post...on the form users enter basic info that gets inserted into a database -- i then send them to a thank you page that i want to do 2 thing first i want to say "thank you blah blah blah....you have entered the follwoing info :NAME: ... EMAIL: ..."

i thought <? echo $HTTP_POST_VARS['firstName']; ?> would display the entered info -- but i was wrong

what am i missing?

Secondly i want this page to email the info as well but if i can get the first part answered then the second shouldn't be a big deal right?

<signature>
sometime you just gotta say &quot;WHAT THE @#*% !!&quot;
</signature>
 
The variables probably aren't available because form variables are only available to the script to which they are submitted.

I don't know the mechanism you're using to send the user to the &quot;thank you&quot; page, but if it involves HTTP redirection, then no data is submitted to the &quot;thank you&quot; page, so the variables are not available.

There are several workarounds I can think of:[ul][li]Just have the first script perform the functions of both scripts through the use of an if...else or a switch construct[/li][li]use session variables[/li][li]pass the variables from the first script to the second in the URL[/li][ul]

Want the best answers? Ask the best questions: TANSTAAFL!!
 
this is the part of the script that redirects

$insertGoTo = &quot;register_pass.php&quot;;
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? &quot;&&quot; : &quot;?&quot;;
$insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];

can i just append the variables to the url

$insertGoTo = &quot;register_pass.php?first=firstName&last=lastName&...&quot;;

or how would i pass the variables from page 1 to page 2 vial url?

<signature>
sometime you just gotta say &quot;WHAT THE @#*% !!&quot;
</signature>
 
thanks man so 1 more questions so in the page it gets passed to i just all them

$firstName = $HTTP_POST_VARS['first'];
$lastName = $HTTP_POST_VARS['last'];

Thank You <? print &quot;$firstName $lastName&quot; ?> for registering.

Will output say

Thank You Billie Bob for registering.

Say the guys name is Billie Bob in the form!

<signature>
sometime you just gotta say &quot;WHAT THE @#*% !!&quot;
</signature>
 
thanks

<signature>
sometime you just gotta say &quot;WHAT THE @#*% !!&quot;
</signature>
 
ok i did this and the output came out as

&quot;Thank You firstName lastName for registering.&quot;

how do i pass the variable over do i have to put

register_pass.php?first=$firstName&last=$lastName

in the url?




<signature>
sometime you just gotta say &quot;WHAT THE @#*% !!&quot;
</signature>
 
thanks sleip.

That last post was a waste of time
i shouldve tried it out first because it seemed to work :/

just getting lazy this Friday!

<signature>
sometime you just gotta say &quot;WHAT THE @#*% !!&quot;
</signature>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top