How to track who clicked a button on the website?

Greetings, colleagues. Explain the essence of the question. There is currently a button "Panic Button", when pressed, plays the sound and the button text changes to "Panic Button - ACTIVE". You need to make it so that when it is pressed, it is keeping track of who clicked it. There is a session $_SESSION['name']; it contains login, how to track and remember to have all users wrote who pressed the button? Perhaps the wording is not clear, if what you say that is not clear. Thanks previously for the help :>
April 4th 20 at 01:00
4 answers
April 4th 20 at 01:02
That is, you made a room where anyone can press it? If Yes, then you need to the user has been registered, and then make a start on this, maybe I'm wrong.
Registration/authorization exists, the button can click, users with a certain access, I need to track user who pressed the button. - Lauretta.Nikolaus commented on April 4th 20 at 01:05
April 4th 20 at 01:04
Write the nickname of the user in the database or in a text file and from there get the rest
April 4th 20 at 01:06
The button should send the form with a hidden aydishnik user
April 4th 20 at 01:08
Don't know how long for you it will be difficult, but possible via ajax to send the request to the handler (keep the state of pressing can be in a separate table in the database, in any user settings (if any), or cookie), then when the page is loaded to the down state and change the button text based on the value.

Find more questions by tags AJAXPHPHTML