Event handling in PHP using controls?
Hello fellows, Please how do one handle events in PHP controls? Or in other words do PHP have events handlers? I am directly referring to the ability to control events like mouse roll over, mouse on focus, mouse out of focus etc? I am presently working on a project that submits a form to a database.
Greg K posted this at 07:27 — 10th September 2014.
He has: 2,145 posts
Joined: Nov 2003
PHP is a server side language, which means all execution is done on the server based (most of the time) upon individual requests from a browser.
in order for it to act upon something you do in the browser (other than responding to you calling a script with options POST/GET data), you need to also include a client-side language, such as Javascript.
Javascript can detect the user interaction, and then make calls to a script on a server usually via AJAX. PHP would process that script and output some type of information that the javascript can work with (such as JSON formatted data).
A big thing to remember is that unlike a standard standalone application, when you make a call to PHP, the script runs and then stops. Each interaction starts a fresh new call to scripts, so you need some method (usually $_SESSION) to keep track of a user's activity between each time a script is called.
Mary Whitley posted this at 10:14 — 5th November 2014.
They have: 2 posts
Joined: Nov 2014
Event handling in PHP
====================
PHP supports Event handling mechanism, it supports different type of Events like Get, Put, Post etc...
Ex.
<?php
class Handler {
function onGET() {
echo "onGET";
}
function onPOST() {
echo "onPOST";
}
function onPUT() {
echo "onPUT";
}
function onDELETE() {
echo "onDELETE";
}
}
?>
Event Handling In Javascript
============================
There is also some other events link mouseover, mousein, mouseout that is suppored by javascripts. we can use this events in our form.
River Delta India is an USA & India based Drupal Web Development Company which has top class team of Drupal Development
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.