Start Html code for validating username and password

Html code for validating username and password

If you run a validation of the users form input before the form is submitted, there will be no wait time and redundant load on the server.

You will need to do a SQL query to check whether the passed user parameters (username & password) correspond to a record in the database.

The trim() function is used in this example to remove the white-spaces (suffix and prefix) that be wrongly entered by the user while typing the username or password.

The goal of Captcha is to validate that a current session user is an actual person and not just a scam machine (Bot).

Moreover, another fundamental functionality that is recommended to be added is the forget password link.

For the simplicity purpose of this example, we hard coded the values "admin" and "admin" as the username and password record that must be matched with the passed parameters.

The professional practice of this step is to apply the validation with the records available in the database (e.g., My SQL, PGSQL ..etc).

The forget password will be used by the user in case he could not remember the password.