Calling a php Function from checkbox's click event

i have a checkbox name=chkpatient . and i have a textbox . i have writen a php function . function name is checkboxchecked.my objective is i want to call these pHP function from check’box onclick event. the moment i will click on the check box it will print “checked”.

function checkboxchecked()
{
if($_REQUEST[‘chkpatient’]==“ON”)
{
$yes=“checked”;
print $yes;
}

}

now my objective is i want to call that function

Use javascript for such things PHP cannot do it since it is Server Side language.

What you need to implement is a XMLHttp (AJAX) call and fetch a PHP url.

onclick=“checkboxchecked()”

Which calls:

function checkboxchecked()
{
if($_REQUEST[‘chkpatient’]==“ON”)
{
AJAXFetchPage(‘/scripts/checkboxRecorder.php?clicked=yes’);
$yes=“checked”;
print $yes;
}
}