Can i make it validate a username and password? | Sololearn: Learn to code for FREE!

+1

Can i make it validate a username and password?

what can I do to make the script validate username and password without use databases?

8/16/2017 11:59:37 AM

Trapido02

7 Answers

New Answer

+8

One way of looking at it- <form> <input type="text" placeholder="Username" id="text1" /><br /> <input type="password" placeholder="Password" id="text2" /><br /> <input type="button" value="Login" onclick="javascript:validate()" /> </form> <script type="text/javascript"> function validate() { if( document.getElementById("text1").value == "workshop" && document.getElementById("text2").value == "workshop" ) { alert( "validation succeeded" ); location.href="run.html"; } else { alert( "validation failed" ); location.href="fail.html"; } } </script>

+2

Database is not a program, it can't validate data for us, it just for storing data. You use Javascript or PHP program to validate the form data.

+1

Javascript can only store client local data using local storage or cookies. Means the stored data is only available for that local pc/phone only, each clients store their own individual data.

0

can I use js?

0

or can I make it store the data in the script?

0

thats my contact form in js hope it helps :) https://code.sololearn.com/W73uL5j0oPBd/?ref=app

0

thank you for the answers everybody. I found what I've been looking for! :D