Curious about user notification techniques. Referring to simple stuff. For example, a user submit's a contact form. Once submitted, the user sees a message which says the form submission was successful.
Here is the question. How do you accomplish this (with PHP), without appending a string to the url? I ask this because I see more and more sites notifying users without using a GET query var in the url.
Are they just storing something in a global var somewhere and reading that/unsetting on read? What techniques are currently used to accomplish this?
To add further, when the form is posted and saved:
//The form has been processed, emailed, etc. Now redirect the user back to the page
//We redirect the user so that if they click refresh, the form doesn't re-submit.
//So without a query var in the url, who does the page no that a form was saved?
//Sessions are one solution, what if sessions are not being used?
header("Location:the_original_page.php");
Simple: cookies (or sessions). Cookies are actually easier because their values are only populated in the subsequent request and they don't eat up your server space and you don't have to rely on sessions.
This kind of postponed messages are usually described as flash messages.
One particular implementation that I like is the Note library of Dingo Framework.
An amazing technology called POST :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With