PHP is a server-side application so there, so you cannot directly call it onClick() because that event happens on the client side.
However, you can call it via JavaScript!  More specifically aJax.
Here's a good place to start
Here's a quick example from What is Sleep`s answer
AJax:
function callPHP() {
    $.ajax ({
        url: "yourPageName.php",
        data: { action : assign }, //optional
        success: function( result ) {
            //do something after you receive the result
        }
    }
PHP:
if ($_POST["action"] == "assign")
{
    assign(your parameters); //You need to put the parameters you want to pass in
                             //the data field of the ajax call, and use $_POST[]
                             //to get them 
}