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