PHP is serverside language so you cant use php functions in onclick. Only javascript which is clientside. Good news is that you can use javascript to create Ajax calls to server and so you can create javascript functions that execute serverside PHP code.
Maybe you want to take a look at Xajax which will do the hard work for you.