PHP中的POST方法无法将数据从移动浏览器发布到数据库

PHP中的POST方法无法将数据从移动浏览器发布到数据库,php,http,post,bootstrap-4,Php,Http,Post,Bootstrap 4,我正在编写一个用户注册表单,其中我将用户的用户名和密码存储在数据库表中。我的网页在桌面浏览器上运行良好。但当我在android的chrome浏览器上试用时,它无法将任何数据发布到数据库中。它甚至没有显示我在php中使用的回声。我是php新手。 我正在为我的网站使用000webhost的免费主机 这是我的表单代码: <form action="store.php" method="POST"> <div class="form">

我正在编写一个用户注册表单,其中我将用户的用户名和密码存储在数据库表中。我的网页在桌面浏览器上运行良好。但当我在android的chrome浏览器上试用时,它无法将任何数据发布到数据库中。它甚至没有显示我在php中使用的回声。我是php新手。 我正在为我的网站使用000webhost的免费主机

这是我的表单代码:

<form action="store.php" method="POST">
                <div class="form">
                    <div class="input_field">
                        <input type="text" name="rname" placeholder="Phone number, username, or email" class="input">
                    </div>
                    <div class="input_field">
                        <input type="password" name="renterPass" placeholder="Password" class="input">
                    </div>
                    <button type="submit" class="btn btn-primary btn-sm">
                    <div class="btn-primary btn-sm">
                            <a href="https://mailsenderdemo.000webhostapp.com/">Log In</a>
                    </div>
                </button>
                </div>
                <!--<input type="submit"-->
            </form>


我使用的PHP代码是:

<?PHP
    header('Content-Type: text/plain');
    $name = $_POST['rname'];    
    $pass1 = $_POST['renterPass'];
    $servername = "localhost";
    $username = "xxxxxxx";
    $password = "xxxxxxx";
    $dbname = "xxxxxx";
    $con = mysqli_connect($servername,$username,$password,$dbname);
    if(!$con)
    {
        die("Error : ".mysqli_connect_error());
    }


    $sql = "INSERT INTO `new`(`name`, `password`) VALUES('$name','$pass1');";

    if(mysqli_query($con,$sql))
    {
        echo "Registration Done Successfully...";
    }
    else
    {
        echo "Something went Wrong...";
    }


    mysqli_close($con);
?>

**试试这个**
**试试这个**

事实上,我最近已经弄明白了。不过,不管怎样,谢谢你。事实上,我最近已经弄明白了。不过,还是谢谢你。
**Try This**        
    <form action="store.php" method="POST">
      <div class="form">
       <div class="input_field">
        <input type="text" name="rname" placeholder="Phone number, username, or email" class="input">
      </div>
       <div class="input_field">
          <input type="password" name="renterPass" placeholder="Password" class="input">
       </div>
       <button type="submit" name="submit" class="btn btn-primary btn-sm"></button>
       </div>
     </form>
    <?PHP
            $servername = "localhost";
            $username = "xxxxxxx";
            $password = "xxxxxxx";
            $dbname = "xxxxxx";
            $con = mysqli_connect($servername,$username,$password,$dbname);
            if(!$con)
            {
                die("Error : ".mysqli_connect_error());
            }
            if(isset($_POST['submit'])){
            $name = $_POST['rname'];    
            $pass1 = $_POST['renterPass'];


            $sql = "INSERT INTO `new`(`name`, `password`) VALUES('$name','$pass1');";

            if(mysqli_query($con,$sql))
            {
                echo "Registration Done Successfully...";
            }
            else
            {
                echo "Something went Wrong...";
            }
        }

            mysqli_close($con);
        ?>