Add button on block body using php How To Add PHP code to the body of a Drupal 7 Block

I just want to make a button on block body. Is that possible? 

this link will explain what i want to do [add button]: http://drupal.org/node/1046700


  This article is for Drupal 7 developers who have tried to put PHP code
  in the body of a Custom Block, but can't get it to run.
I'm not sure why you need this and you want a similar module of PHP filter which adds a new text format. 

If you are familiar with custom moduling and hooks, I would give you a straightforward solution.
You could implement this using hook_block_view_alter by defining custom patterns (tokens).

&lt;?php
function mymodule_block_view_alter(&amp;$data, $block) {
    $patterns       = array('[add button]'); # more replacement patterns here
    $replacements   = array('&lt;button type="button"&gt;Button&lt;/button&gt;');
    if(isset($data['content'])){
        $content = $data['content'];
        if(is_string($content)) {
            $data['content'] = str_replace($patterns, $replacements, $content);
        }
        elseif(is_array($content)) {
        }
    }
}




Here is the result.


You may expand the code as you like such as defining more tokens, adding criteria for certain blocks, user roles, etc. You can even create an administration page at admin/config to define token replacements from UI.