After the user submits a form, it is usually a good idea to display a confirmation page. It might be jarring to go directly to the privacy page. I would set it up like this: index.php?page=contact -> shows the form index.php?page=contact-submit -> shows the confirmation with privacy policy text
How best to navigate to a PHP page after a form submit?
11–13 of 13 posts
The privacy page is just an example. Your scenario replaces it with a confirmation page. So the problem still stands: How do you go to the ?page=contact-submit page? Do you use header()? Is that the canonical way?
Re: How best to navigate to a PHP page after a form submit?
#12like you said, there's limited options, and each one has its individual drawbacks, but header redirect fits my needs when i'm doing php development. ymmv. plus, when making decisions, i tend to follow the "whats best for my users" test. in this case, as you've stated it, its seamless IDE integration vs having a consistent external link structure. a no brainer, imo.
All true. I've bounced back and forth. On a previous project, there was no need for stepping through the code, so header() trumped. My current project has benefitted greatly from the IDE, so I'm using a session var (and hoping the user refrains from bookmarking! :)
Re: How best to navigate to a PHP page after a form submit?
#13Your question is a common one in web development. I highly recommend learning how to use Zend Framework. Even if you choose to not use the framework for any real projects, the things that you learn will significantly improve your knowledge of PHP and give you a much better understanding of how to deal with problems such as the one posed by your question.
I tried ZF a while back, but don't recall how it would resolve this issue. Can you be specific?