Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
161 views
in Technique[技术] by (71.8m points)

forms - PHP POST values to another page

I have a rather larger form and when it submits it posts to the same page as the form and runs the PHP validation.

Basically if all is validated correctly I want to then show a different page with all the information that has been posted on it a sort of report or confirmation allowing the user to print the report. The data in the form is not stored in any database its just emailed off.

What I am having trouble with is retrieving the values as the form action is not going to the report page just itself. I therefore need some advice.

Should I look for a way of changing the form action location with an if i.e. if all valid echo report.php but this would require the user to resubmit the form, or is there a better way?

Your advice would be greatly received.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You should probably store your values in Session before redirecting. Then in your other page read them out, and clear them.

See also: PHP Pass Data with Redirect

edit: You may also want to take a look at the Post-Redirect-Get (PRG) pattern. Googling it should bring up some usable examples


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...