if (/*Condition to redirect*/){ //You need to redirect header("Location: http://www.yourwebsite.com/user.php"); /* Redirect browser */ exit(); } else{ // do some }