change page status with code

I figured out how to change the post status and information through code.

<?php $my_post = array('ID' => 77, 'post_title' => 'on','post_content' => 'on','post_status' => 'draft',); wp_update_post( $my_post );?>

Now I just need to figure out how to make it run when a button is clicked.