brown2005 Posted November 11, 2011 Share Posted November 11, 2011 hi i have created a login form. and a login-process form... the login form currently has the following jquery attached $(document).ready(function() { $('#btn-submit').click(function() { $(".error").hide(); var hasError = false; var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/; var emailblockReg = /^([\w-\.]+@(?!gmail.com)(?!yahoo.com)(?!hotmail.com)([\w-]+\.)+[\w-]{2,4})?$/; var emailaddressVal = $("#email").val(); if(emailaddressVal == '') { $("#email").after('<span class="error">Please enter your email address.</span>'); hasError = true; } else if(!emailReg.test(emailaddressVal)) { $("#email").after('<span class="error">Please enter a valid email address.</span>'); hasError = true; } var passwordVal = $("#password").val(); if(passwordVal == '') { $("#password").after('<span class="error">Please enter your password.</span>'); hasError = true; } if(hasError == true) { return false; } }); }); now i would also like to add whats in the login-process.php $login_sql = mysql_query("SELECT * FROM members,people,people_emails WHERE members_person=people_id AND people_emails_person=people_id AND people_emails_email='$email' AND members_password='$password'"); if(mysql_num_rows($login_sql)>0){ echo"yes ok"; }else{ echo"Email and/or password do not match"; } into the jquery check to check before submiting.. and then process an error on the form when email or password dont match. Quote Link to comment https://forums.phpfreaks.com/topic/250963-login-form-without-refresh/ Share on other sites More sharing options...
trq Posted November 12, 2011 Share Posted November 12, 2011 Have a look at the documentation on jQuery's $.ajax method. Quote Link to comment https://forums.phpfreaks.com/topic/250963-login-form-without-refresh/#findComment-1287493 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.