Reaper0167 Posted December 30, 2008 Share Posted December 30, 2008 Can javascript be used to display an error on the same page as my log in form. Lets say someone enters their username and password but they were never registered. Could javascript work with PHP to display the error on that same page. Right now i have a html page with my form, and a php page that is my log in script. When a user logs in with a invalid username it takes them to another page to display the message.(don't like that at all) Quote Link to comment Share on other sites More sharing options...
Reaper0167 Posted December 30, 2008 Author Share Posted December 30, 2008 Maybe the right way to ask is if Javascript can be used to call a variable from my PHP login script and display it on my html form. Quote Link to comment Share on other sites More sharing options...
Reaper0167 Posted December 30, 2008 Author Share Posted December 30, 2008 after searching on google for some time now... it seems like ajax may play a big part in this. Quote Link to comment Share on other sites More sharing options...
Philip Posted December 30, 2008 Share Posted December 30, 2008 Yes, look into using ajax, its exactly what you're going to want to use. Login info (via JS) -> PHP check response -> Display error/success (via JS) However, if you did, make sure your users can still login if their browser has javascript disabled. Quote Link to comment Share on other sites More sharing options...
Reaper0167 Posted December 30, 2008 Author Share Posted December 30, 2008 are there any sites out there that have some tutorials on how to do this. i hate to keep asking for this kind of stuff, but i really want to know how to do it. thanks. Quote Link to comment Share on other sites More sharing options...
Adam Posted December 30, 2008 Share Posted December 30, 2008 Really helpful tutorials: http://www.w3schools.com/ajax Some useful examples: http://www.w3schools.com/ajax/ajax_examples.asp A Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.