Skip to content
Advertisement

Make div visible using only PHP as event listener

I am testing to set up an “button event listener” that would show a hidden div at button click. Below code works, my question is more if there are other ways of solving this, with only HTML/CSS and PHP ?

I am fully aware the “button event listener” in this particular case is more of a “superglobal $_POST variable” checker.

The purpose of the test was more to see if the button press can be scanned from PHP itself (skipping other logics such as JS or jquery, etc).

JavaScript

Advertisement

Answer

first check if is post request and do visibility with php variable:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement