A. G
A. G

Reputation: 951

My html form values don't get sent to MYSQL database

This is the code for a signup system that I am creating. Every time I get the same output saying "User not registered". What am I doing wrong? I have added my php and html code below.

<?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);"/>

Upvotes: 1

Views: 65

Answers (1)

Mohamed Anouar Hrairi
Mohamed Anouar Hrairi

Reputation: 33

i think you should delete ' from 'usermanagement' because that's how it's reading your table's name

Upvotes: 1

Related Questions