If you need something to happen client side in order to interact with PHP (without reloading the page), then you need to use some form of AJAX. xajax will do that. example: This will take the value from a div 'myDiv', pass it to PHP, increment it by one, update the value in that div, and call the javascript functions unload() and load()
$xajax = new xajax();
// Register Functions
$xajax->registerFunction('myUpdate');
function myUpdate($index)
{
$objResponse = new xajaxResponse();
$objResponse->addClear('myDiv', 'innerHTML');
$objResponse->addAssign('myDiv', $index++);
$objResponse->addScript('unload()');
$objResponse->addScript('load()');
return $objResponse;
}
And you'd call this via javascript using
<a href="javascript:void(0);" onclick="xajax_myUpdate(document.getElementById('myDiv'));">Click Me to Lowercase String</a>
I'm not familiar with ajax without the xajax library, so I can't provide much help beyond that.
But you definitely need AJAX for what you're looking to accomplish.