 <p>You will need to combine it with AJAX or jQuery codes. It is not only php!</p> <p>Check this out: - <a href="http://stackoverflow.com/questions/10805187/jquery-login-form-in-div-without-refreshing-whole-page">jquery login form in div without refreshing whole page</a></p>