PHP related question.?

Do I always need to write the login page in "login.php" format? Or I can write that in "login.html" format and in the form I shall simply put "Action" as "validation.php" and validate it. Is it possible??

1 Answer

  • Lv 7
    1 month ago

    it is best practice, when using PHP, that ALL your pages be .php, even if you have no php code in them.

    that way, if you DO decide to add php later, you can without messing up links to it on other pages.

    also, if you are using "IF" code correctly in your login page, you dom't need a separate page to validate.

    just start the page by checking if $_POST is set, and if not, load the login page. and if it is set, run validation and end with either a redirect, or if validation fails, continue loading the login page with errors.

    itxs quite wonderful once you learn it!

    • Commenter avatarLogin to reply the answers
Still have questions? Get your answers by asking now.