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) Link to comment https://forums.phpfreaks.com/topic/138814-question-about-js/ 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. Link to comment https://forums.phpfreaks.com/topic/138814-question-about-js/#findComment-725877 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. Link to comment https://forums.phpfreaks.com/topic/138814-question-about-js/#findComment-725965 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. Link to comment https://forums.phpfreaks.com/topic/138814-question-about-js/#findComment-725994 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. Link to comment https://forums.phpfreaks.com/topic/138814-question-about-js/#findComment-726000 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 Link to comment https://forums.phpfreaks.com/topic/138814-question-about-js/#findComment-726052 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.