Can't pass $_POST variable using header() function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jeremyphpdn
Forum Newbie
Posts: 6
Joined: Thu Dec 21, 2006 6:38 pm

Can't pass $_POST variable using header() function

Post by jeremyphpdn »

I want to use the PHP header function to open a window using the header() function and pass a parameter. I don't want to use the GET parameter option because I don't want the URL to display the teambookingid parameter.

First the user enters their user and password in the page Team-Login_Input.php and hit Submit. This submits POST data to Team-Login_Results.php which performs a check in the database for a record with that login and if criteria is satisfied the header function gets launched. The script used to contain in the URL "?teambookid=XXX" but I don't want the client to see the URL and I thought I could perform this using the POST parameter passing method.

Right now the header function is contained in the script Team-Login_Results.php and looks like this
header("Location: ".URLString()."/TeamLogin/Group_Rooming/Test_GroupRoom_List.php");

However, it seems from what I've read the header function is creating a HTTP Response back to the client browser and so the POST array is empty when I perform a print_r($_POST) and not accessible to the program.

I've read there may be a server-side function like the Apache mod_rewrite which can mask the URL from the client but I would prefer to just pass a parameter because it seems easier.

Can anyone offer insight to my problem?
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

jeremyphpdn
Forum Newbie
Posts: 6
Joined: Thu Dec 21, 2006 6:38 pm

Resolved

Post by jeremyphpdn »

I was able to use session_start on one page, declare variable, and use session_start on next page to retrieve previous variable contents. Thanks for the help.
Post Reply