html - PHP not working as expected -
i have simple form calling php
script upon submit not work expected. takes me 'localhost:8080'
without error messages not there in php
script. please have @ code below , tell me how correct this. had below form post
not working @ all, i.e., php file not getting post data. switched get
, worked time , not working. may settings problem. using wamp x64
on windows 7 x64
, have not modified setting.
this form -
<form role="form" action="/login.php" method="get"> <div class="form-group"> <label for="email">email:</label> <input type="text" class="form-control" placeholder="username@xyz.com" name="email"> </div> <div class="form-group"> <label for="password">password:</label> <input type="password" class="form-control" placeholder="password" name="password"> </div> <div class="form-group"> <label><a href="/forgot-password">forgot password?</a></label> <label><a href="/new-user"> new user?</a></label> </div> <button type="submit" class="btn btn-lg btn-primary center-block">submit</button> </form>
this php
file -
<?php if (isset($_session)) { header("location: http://localhost:8080/home"); } else { if (isset($_get['email']) , isset($_get['password'])) { $email = $_get['email']; $pass = $_get['password']; $con = mysqli_connect('localhost','read','*****','sheet_db'); if(mysqli_connect_errno()) { header("location: http://localhost:8080/?message=internal%20error"); } else { $check = mysqli_query($con, "select count(emp_id) cnt d_emp emp_email = '".$email."' , password = '".$pass."'"); if(mysqli_fetch_array($check)['cnt'] == 1) { session_start(); $_session['email']=$email; header("location: http://localhost:8080/home"); } else { header("location: http://localhost:8080/?message=wrong%20username%20or%20password"); } } } else { header("location: http://localhost:8080/?message=invalid%20parameters"); } } ?>
change action="/login.php"
action="./login.php"
let me know if solves problem.
Comments
Post a Comment