PHP POST values to another page

2019-09-19 10:05发布

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.

标签: php forms post
1条回答
叛逆
2楼-- · 2019-09-19 10:06

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

查看更多
登录 后发表回答