我的html表单值不会发送到MYSQL数据库

时间:2017-07-14 10:08:25

标签: php html mysql database

这是我正在创建的注册系统的代码。每次我得到相同的输出说“用户没有注册”。我究竟做错了什么?我在下面添加了我的php和html代码。

<?php
require_once('connect.php');
  if (isset($_POST['submit']) && !empty($_POST['submit'])){
      $date = $_POST['date'];
      $name = $_POST['name'];
      $email = $_POST['email'];
      $password = $_POST['password'];
      $gender = $_POST['gender'];
      $phone = $_POST['phone'];
      $address1 = $_POST['address1'];
      $address2 = $_POST['address2'];
      $country = $_POST['country'];
      $zip = $_POST['zip'];
      $city = $_POST['city'];
      $state = $_POST['state'];
     $sql = "INSERT INTO `usermanagement` (date, name, email, password, gender, phone, address1, address2, country, zip, city, state) VALUES('$date', '$name', '$email', '$password', '$gender', '$phone','$address1', '$address2', '$country', '$zip', '$city', '$state')";//
      $result=mysqli_query($connection, $sql);
      if ($result){
          echo "User succesfully refgistered";
      }
      else {
          echo "User not registered";
}
  }  
    
   ?> 
<form method="post"; style="width:1000px;">
        <input name="dateob" type="text" id="datepicker" class="form-control" style="width:200px;margin-bottom:-20px;margin-left:220px;" />
    <input type="text" name="name" required placeholder="Full Name*" class="form-control" style="width:200px;margin-top:-42px;" />
    <div class="form-group">
        <input type="email" name="email" required placeholder="Email*" class="form-control" style="width:200px;margin-top:20px;" />
        <input type="password" name="password" required placeholder="Password*" class="form-control" style="width:200px;margin-top:-43px;margin-left:220px;" />
    </div>
    <div class="form-group"></div>
.............
        <input type="text" name="state" required placeholder="State*" class="form-control" style="margin-top:-42px;width:200px;margin-left:210px;" />
        <input class="btn btn-primary btn-block" value="Next" name="submit" type="submit" style="background-color:rgb(51,193,159);"/>

1 个答案:

答案 0 :(得分:1)

我认为您应该从'删除'usermanagement',因为这就是它如何读取您的表格名称