hello, I just want to ask how to call a php function through JavaScript Events.. for example: <a href=\"#\" onmouseover="phpfunction();"> PHP: thank you...
well, one possibility is to do something like onmouseover="window.location.href='myScriptPage.php?shouldIDoPHPFunction=1' " Code (markup): then in the myScriptPage.php do something like if ($_GET['shouldIDoPHPFunction']== 1) //run the php script. Code (markup): That's the only workaround I can think of. You could of course call the same page rather than another page (myScriptPage.php). However, it sounds like you're trying to do something counterintuitive since as someone else said php is server side and javascript is client side--therefore, no matter what, you are going to need to send a server requrest to do a php function .
You dont need to actually return XML. Just return plain text if you like and do whatever you need with it. Good Luck!
ah ok, ive think of that, thanks... wat about <body onunload="phpfunction()"> i just want to alter something in the mysql db, whenever a user closes the page.
You.. can't.. You're going to have to integrate JavaScript or something like it in order to control client data that way.
"You cant call server side PHP functions with client side javascript code"-nico told it.If u want to perform certain server side work on any events then the best way is to use AJAX(XMLHttpRequest).just send the request to a server side PHP script and do the work in that script.