/    Sign up×
Community /Pin to ProfileBookmark

About the "Temporary redirect"

In a webpage I put a formulary that uses “get” and “post” methods.

The form in this first page sends all the data to another .php file that evaluates the data. If there is a problem, the second page heads to the first page, writing an url with more variables to be obtained with the get method by the first page, and the same variables that this second page received by the “post” method, using:

header(“HTTP/1.0 307 Temporary redirect”);
header(“location: firstpage.php?data1=xxx&data2=xxx”)

The problem is that when I submit the form in the first page, the browser takes a lot of time only to say “second page not found”.

If I quit the line
header(“HTTP/1.0 307 Temporary redirect”)
of the code of the second page, the form works correctly and i go back to the first page again, with the “get” data, but obviously, I loose all the “post” data.
What I want to say with this, is that the problem with “page not found” is caused by the code line of the “temporary redirect”. But, why? Thanks for your answers.

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@ShrineDesignsJun 18.2005 — header("HTTP/1.0 307 Temporary redirect") this not necessary, because the server will automatically send the redirect header when you use header("location: firstpage.php?data1=xxx&data2=xxx"), beside, i think the 307 header you are sending is incorrect to begin with, which is cause the problem

if you want to repopulate the form with the post data, make the form self-validating, this way you don't expose the data (ie: by dumping the post data into the get variables, which will comprimize any personal data) to the net
×

Success!

Help @arturion spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...