I am actualy tring to get the posted data from a views filter and display it inside a custom block.

This is what my code looks like for now

 * Implements hook_block_info().
function search_block_header_block_info(){
    $block['search_header'] = array(
        'info' => t('Search Header'),
        'cache' => DRUPAL_NO_CACHE,
    return $block;

 * Define what our block is going to look like.
 * Implements hook_block_view().
function search_block_header_block_view($block_key){
    $block = array();

    if($block_key == 'search_header'){ //We only want to define the content of OUR block

        //This is the title of the block.
        $block['subject'] = t('Search Header');

    return $block;

But for some reason the $_POST variable is always empty. Someone got a hint for me how to get the posted data?

  • what is actual use of this ? are you trying to debug or something ? just curious :)
    – shrish
    Jul 10, 2014 at 9:48
  • Hehe I want to put this block above my search form to display the searched string inside a "Drupal Status Message"
    – Sebastian
    Jul 10, 2014 at 9:51

2 Answers 2



$view = views_get_current_view();

instead $_POST.

  • My pleasure :-)
    – Djouuuuh
    Jul 10, 2014 at 11:33

Views always user GET method to pass the parameter to filter the data. So if you are checking the data in custom blocks just try getting it by the use of $_GET['key']

Views always user params as Querystring so its not the right method to get the data i think.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.