Does PHP have 'event-handler'?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
chakhar86
Forum Commoner
Posts: 45
Joined: Mon Jun 05, 2006 1:36 am
Contact:

Does PHP have 'event-handler'?

Post by chakhar86 »

In javascript you can easily run function when an 'event' occured...
can this 'event-handler' (onchange, onload, etc.) implemented in PHP?
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

Yes an no. Not directly in PHP, but with Javascript and PHP together (AJAX) it can.
chakhar86
Forum Commoner
Posts: 45
Joined: Mon Jun 05, 2006 1:36 am
Contact:

Post by chakhar86 »

tecktalkcm0391 wrote:Yes an no. Not directly in PHP, but with Javascript and PHP together (AJAX) it can.
and how can it be done? or where we can find its guide or manual...
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Re: Does PHP have 'event-handler'?

Post by RobertGonzalez »

chakhar86 wrote:In javascript you can easily run function when an 'event' occured...
can this 'event-handler' (onchange, onload, etc.) implemented in PHP?
No. The only event handler PHP has (for web apps anyway) is a server page request. PHP is server side. In order to initialize any PHP commands or code, you need to tell the server to process something. That is done through a page request (like I said, for web apps at least). Even with AJAX, processing ocurrs on the server. The JavaScript event handlers trigger the server interaction.
Post Reply