markzzz
markzzz

Reputation: 47995

header() function : a small curiosity

As for the PRG model, on my web application I process data on the server and than I do a redirect by using header('Location: misc/page_done.php&message=1');

For manage the output, on my page_done.php I've a sort of select case when, due to the message variable value (1,2,3, and so on), I'll print the right output message to the user.

This by using GET to pass the variables to the redirected page. Could I pass this variables (in my example, the string message) trought POST instead of GET? Yeah, looks stupid, but just for curiosity...

Upvotes: 0

Views: 48

Answers (2)

Jess
Jess

Reputation: 8700

The simple answer is no. Using header Location you can't pass things through post, only get.

Upvotes: 1

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 799240

No. Redirects forced in this manner can never result in a POST. Put the variable in a session if you don't want to show it in the URL.

Upvotes: 4

Related Questions