Can PHP handle mouse events? [closed]


I’m a newbie in php and i want to know if php can handle mouse events such as upon mouseCicked, mouseDoubleClicked, mouseMoved, mouseHovered etc..
And can events like button click , like displaying alert after clicking the submit button
If yes, how can it be done ?
I know that this can be done in Javascript

<script>    
window.onbeforeunload = "Are you sure you want to leave?";
<script/>

Are there any other ways to do it ?

Thank You !

5 Responses to “Can PHP handle mouse events? [closed]”

  1. NullPoiиteя says:

    PHP an not handle mouse even since its server-side programming language

    Server Side language(PHP etc) They retrieve records from databases, maintain state over the stateless HTTP connection.

    PHP is executed on the server and outputs some HTML and maybe JavaScript code which is sent as response to the client where the HTML is interpreted and the JavaScript is executed

    enter image description here

    so you need to use client side programming language(JavaScript) to handle mouse event

    Good Read

    1. Reference: Why does the PHP (or other server side) code in my Javascript not work?

  2. CodeBeard says:

    No, PHP is a back-end language. The user’s mouse doesn’t exist on the server. You would need to handle this in javascript.

    You will want to use a confirm('message') box on the page attached to the onbeforeunload event. On the body should be enough I think.

  3. Ben McDougall says:

    You can place your mouse events in the HTML tag and call the JavaScript, JQuery or AJAX function in the response as is done here.

    And here is a list of all the events you can call and make your site interactive : List.

  4. GlenH7 says:

    How do you image that? It can’t even handle visual apps just console. It is running on server-side, thus there is no way to handle client-side webbrowser events.

Leave a Reply

You must be logged in to post a comment.

Question and Answer is proudly powered by WordPress.
Theme "The Fundamentals of Graphic Design" by Arjuna
Icons by FamFamFam