Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

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

1 Answer

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...