victordeassis Posted August 13, 2014 Share Posted August 13, 2014 Hi guys! I've been working on a login form and I have some problems to validate the input data, I need to consist if the login and password fields aren't with spaces or no allowed characters, for this I've been used JavaScript for client-side validation, but if the fields are Ok, I need to call my php function to see if the user and pass are on mySQL database. I don't know how to "call" the php after the JavaScript validation. If someone could help me I will be thankful. Link to comment Share on other sites More sharing options...
niche Posted August 13, 2014 Share Posted August 13, 2014 (edited) Javascript inapproriate for validation because a user can turnoff their JS. <?php some code ?> is how you "call" php. Sounds like you should complete the php tutorials: http://www.w3schools.com/php/default.asp Edited August 13, 2014 by niche Link to comment Share on other sites More sharing options...
davej Posted August 13, 2014 Share Posted August 13, 2014 Your Javascript code can call Php with Ajax. http://www.w3schools.com/ajax/ajax_aspphp.asp Link to comment Share on other sites More sharing options...
dsonesuk Posted August 13, 2014 Share Posted August 13, 2014 (edited) Validate and sanitize data USING PHP from form first, before checking through database, then use javascript validation before using ajax to go to this php page, from login page. Edited August 13, 2014 by dsonesuk Link to comment Share on other sites More sharing options...
niche Posted August 13, 2014 Share Posted August 13, 2014 Except, users can disable their JS. Then JS validation is no go. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now