How to make popup login and register from index.php to work and to parse data in mysql
I have:
Index.php, login.php, register.php
In index.php I have modal popup and I want to user can login and register from popup.
I try with ajax but not working.
Here is my code:
ajax.php:
function validLogin(){
var email=$('.email').val();
var password=$('.password').val();
$.ajax({
type: "POST",
url: "sign-in.inc",
data: "name="+username+"&pwd="+password,
success: function(html){
if(html=='true'){
alert ("Correct");
}
else{
alert ("Wrong");
}
}
});
}
and here is popup form :
<div id="login">
<form class="form login-form" name="login-popup" >
<a class="btn-facebook" href="#"><span><i class="fa fa-facebook"></i>
</span><span>Login with Facebook</span></a>
<a class="btn-google" href="#"><span><i class="fa fa-google-plus"></i>
</span><span>Login with Google</span></a>
<p class="fieldset">
<label class="image-replace email icon-log" for="signin-email">E-mail</label>
<input class="full-width has-padding has-border email" id="signin-email" name="email-login" type="email" placeholder="E-mail" name="email" required>
<span class="error_box"></span>
</p>
<p class="fieldset">
<label class="image-replace password" for="signin-password">Password</label>
<input class="full-width has-padding has-border password" id="signin-password" type="password" placeholder="Password"
name="password" required>
<a href="#0" class="hide-password">Show</a>
<span class="error-message"></span>
</p>
<p class="fieldset">
<input type="checkbox" id="remember-me" checked>
<label for="remember-me">Remember me</label>
</p>
<p class="fieldset">
<input class="full-width orange" id="login-submit" type="submit" name="submit" onclick="validLogin()" value="Login">
</p>
</form>
<p class="form-bottom-message"><a href="#0">Forgot your password?</a></p>
<!-- <a href="#0" class="close-form">Close</a> -->
</div>
Please help me I try but I only get error and send this url:
http://website.com?email-login=proba%40gmail.com&password=vasgas85&submit=Login#0