It looks for the values of "submit", "email", etc. which are not available yet if you just loaded the page. Try placing the code above into the earlier part of "register.php", there it will check for the details. If ever it detects a wrong detail input, just make it go back to the register page.