Drupal form error message displaying on next page reload

Today while working I faced with very strange situation. On my theme I had displayed/rendered a block. I had displayed block on the welcome page and using following code.

In my template aka tpl file, I had written this code:

<div class="content">
    <?php print render(drupal_get_form('user_login_block')); ?>
</div>

 

Now, Error messages related to the login (e.g. "Password incorrect.", etc.) were not getting dispalyed when the login failed.  They would show up only after reloading the page again. So during next page reload the error message of previous page were being displayed.

What I

Tags: