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
User avatar
jwalsh
Forum Contributor
Posts: 202
Joined: Sat Jan 03, 2004 4:55 pm
Location: Cleveland, OH

Event Handler

Post by jwalsh »

I'm planning on building an event handler shortly, and have a question about passing arguments to the handler... Here's an example of what I would like to do... How can I pass the $_POST array as an argument, this doesn't seem to be working.

The test right now has a name field, which is posted to the page, then passed through the dispatch using the $_POST as an array argument for the field. The following code echo's nothing.

Code: Select all

function Dispatcher($event, $data) {
	// GRAB AN EVENT AND PROCESS THE DATA
	switch ($event) {
		case "testhandler":
			// USER ENTERED FIRST AND LAST NAME
			
			echo $data['name'];

	}
}
and the code that calls the handler...

Code: Select all

Dispatcher("testhandler", $_POST);
Post Reply