Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

User Notification

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");
like image 900
Chris Avatar asked Jan 19 '23 14:01

Chris


2 Answers

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.

like image 78
Alix Axel Avatar answered Jan 28 '23 01:01

Alix Axel


An amazing technology called POST :)

like image 20
Ry- Avatar answered Jan 28 '23 00:01

Ry-