0
<?php
//    include_once '../include/user_functions.php';
    if(isset($_POST['btn'])){
        $data=$_POST['frm'];
//        user_login($data);
        var_dump($_POST['frm']);
    }
?>
<!DOCTYPE html>
<html lang="fa">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="Mosaddek">
    <meta name="keyword" content="FlatLab, Dashboard, Bootstrap, Admin, Template, Theme, Responsive, Fluid, Retina">
    <link rel="shortcut icon" href="img/favicon.html">
    <title>FlatLab - Flat & Responsive Bootstrap Admin Template</title>
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/bootstrap-reset.css" rel="stylesheet">
    <link href="assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
    <link href="css/style.css" rel="stylesheet">
    <link href="css/style-responsive.css" rel="stylesheet" />
</head>

  <body class="login-body">

    <div class="container">

      <form class="form-signin" action="" method="post">
        <h2 class="form-signin-heading">login now</h2>
        <div class="login-wrap">
            <input type="text" class="form-control" placeholder="username" name="frm[username]"autofocus>
            <input type="password" class="form-control" name="frm[password]" placeholder="password">
            <label class="checkbox">
                <input type="checkbox" value="remember-me">remember me
                <span class="pull-right"> <a href="#"> forget password?</a></span>
            </label>
            <button class="btn btn-lg btn-login btn-block" value="btn-button" name="btn" >login</button>

        </div>

      </form>

    </div>


  </body>
</html>
  1. When i change form method to get that works fine.

  2. when i use browser network tab headers form data has value

  3. When I change if(isset($_POST['btn'])) to vardump($_POST) it return array(0) { } all the time.

  4. I run php on xampp

upload_max_filesize=130M post_max_size=130M

any additional information needed?

Barmar
  • 741,623
  • 53
  • 500
  • 612
movAhed
  • 73
  • 1
  • 2
  • 14

1 Answers1

1

I think your issue is your use of the Content Security Policy Header "Upgrade Insecure Requests" which has a couple of minor bugs when used over plain (insecure) HTTP.

Because your localhost is HTTP this might be interrupting the POST data because the "Upgrade Insecure Requests" header is trying to send to a HTTPS address and so might be blocking (stripping) out the POST data when finding it can't reach .

Please try and disable your "upgrade insecure requests" header (and possibly clear your browser cache) and see if this helps your issue?

It may also depend on the browser used, as CSP is only currently on some browsers.

Martin
  • 22,212
  • 11
  • 70
  • 132