Justin,
Did you ever figure this out if its possible? I am needing the same thing. Here's my scenario that may help to explain the need.
I have a form with a field called site_id. When I type something in this field, I want to run an onChange javascript that passes the value to a php code to check to see if the site it up by pinging it and checking a database. It then will pop an alert box if it is down.
Example of what I would like to do:
$my_variable = document.Hotel.orig_site_id.value;
If there is a way to do this in php, I would like to hear it. It could be easily done if I was pressing a button but I want it automatic.
-Chris