+ 1

PHP $_session variable how can i use PHP $_session variable to display error notification on the same web-page?

I want to get error notification on same web page if someone inter wrong roll number or wrong id ,the notification shows after hit the submission button if roll no or id is correct then result will show if not then error notification appears on the same page ,like your roll no or id is invalid or wrong. I want to get this notification by ' PHP $_SESSION ' variable I just ask how to code for notification using $_SESSION variable.

2nd Nov 2019, 2:54 PM
Muhammad Aqeel
Muhammad Aqeel - avatar
2 odpowiedzi
+ 2
If I'm not wrong session global variable is used to store information about users in a session, which can be accessed by multiple web pages within the site. If you want to show error notifications you can use a simple alert, or modal. You could also use just a echo , by fetching data from validation from database. But it would not be good UX.
8th Nov 2019, 5:34 PM
Yathin Babu
Yathin Babu - avatar
0
This is one way to do it, <?php $message = ""; if (1!=1){ $message = "Error text"; } else { $message = "All is good"; } echo $message; ?>
15th Nov 2019, 6:54 PM
Christopher Koll
Christopher Koll - avatar