I have created a login form for my website, but the issue is how to process the data provided in the form by the uses. You see, I can't just write a basic function like this one -

if(usename==='xyz' && password==='pqr');
return true;
return false;

'Cause it will be clearly visible to all in the inspection. What should I do?

Also, I should mention that I am not really good at developing, I only got some basic knowledge of HTML, CSS, and JavaScript


Login should always be processed by a server side code. One of the example is php. The php part would retrieve the username and password and query with the database and check if the pair exist. You need to learn some server side language. It can be any language like php, java, python or nodejs. As you already have knowledge of javascript, you can go with node.js.

|improve this answer|||||

There are two types of form validation. There is a client-side validation and the server-side validation. Client-side is validation that occurs in the browser before the data has been submitted to the server. This is more user-friendly than server-side validation as it gives an instant response. This can be further subdivided: JavaScript validation is coded using JavaScript. It is completely customizable. Built-in form validation using HTML5 form validation features. This generally does not require JavaScript. Built-in form validation has better performance, but it is not as customizable as JavaScript.

Server-side validation is validation which occurs on the server after the data has been submitted. Server-side code is used to validate the data before it is saved into the database. If the data fails authentication, a response is sent back to the client to tell the user what corrections to make. Server-side validation is not as user-friendly as client-side validation, as it does not provide errors until the entire form has been submitted. However, server-side validation is your application's last line of defense against incorrect or even malicious data. All popular server-side frameworks have features for validating and sanitizing data (making it safe). My advice would be you master both since having some validation on the browser helps with interactivity with the user too.

|improve this answer|||||

Not the answer you're looking for? Browse other questions tagged or ask your own question.