php - if(html==true) not satisfying this condition -


after checking email , password table suppose go in studentdashboard.php file. every time getting false , give error wrong id or psd.

here html markup:

login.php:

<form action="login.php" id="loginform" name="loginform" method="post" onsubmit=" return validate();">                 <div class="form-group">                    <label for="exampleinputemail1">email address</label>                    <div class="input-group">                    <span class="input-group-addon" id="basic-addon1"><span class="glyphicon glyphicon-user"></span></span>                      <input type="email" name="email" class="form-control" id="exampleinputemail1" placeholder="enter email" required>                    </div>                    <p id="statusemail"></p>                  </div>                 <div class="form-group">                     <label for="exampleinputpassword1">password</label>                      <div class="input-group">                    <span class="input-group-addon" id="basic-addon1"><span class="glyphicon glyphicon-star"></span></span>                      <input type="password" name="password"class="form-control" id="exampleinputpassword1" placeholder="password" required>                    </div>                     <p id="statuspsd"></p>                   </div>                  <hr/>                    <p id="status"></p>                  <button type="button" class="btn btn-success"><span class="glyphicon glyphicon-arrow-left">back</button>                  <button type="submit" name="submit" id="loginbutton" class="btn btn-primary"><span class="glyphicon glyphicon-lock">login</button>                  <p><br/></p>                  <p id="notice"> if not registered yet</p><br/>           <button type="button" id="signup" class="btn btn-danger">singup</button>  </form> 

here jquery code:

$(document).ready(function(){      $("#loginbutton").click(function(e){       email=$("#exampleinputemail1").val();        e.preventdefault();       password=$("#exampleinputpassword1").val();       $.ajax({            type: "post",             url: "studentlogin.php",             data: "email="+email+"&password="+password,              success:function(html)               {               if(html==true){                ---> function not working while login correct data                 window.location="studentdashboard.php";                }                else{                 $("#status").html("<p>worng id or psd</p>");                }             }        });     }); }); 

and studentlogin.php code

<?php $link = mysqli_connect('localhost','root','','users');  if (!$link) {      die('could not connect mysql: ' . mysqli_error($link));  }   if(isset($_post['submit'])) {   echo "submit";   $email=$_post['email'];    $password=$_post['password'];    $sql = "select * student email='$email' , password='$password' ";    $query = mysqli_query($link,$sql);    $result= mysqli_num_rows($query);    if($result > 0)   {        echo 'true';   }   else   {       echo 'false';   } }    mysqli_close($link);   ?> 

studentdashboard.php file print "hi" nothing else.

if need more details let me know

instead of: if(isset($_post['submit'])){ } in studentlogin.php file changed

if( isset($_post['email']) && isset($_post['password']) ) { , works


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -