Php is the server side programming. And some reason onclick event does not use or work in php. But you can Use the other method which performs action when onclick event occur. This onclick event alternate method is form. By through form you can transfer the value from one page to another page when onclick event occur. But in these case you must specify value in the input section and you can give input type as hidden. Form it has two methods get and post method. And when user click the submit button the value is passes and action will be performed. If you have anything different alternate method to use onclick in php give your comments.