1

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

6
  • You're not checking errors. Commented Jul 14, 2017 at 10:10
  • 1
    You should try to print mysql_error(); mysqli_query($connection, $sql) or die(mysqli_error($db)); Commented Jul 14, 2017 at 10:11
  • 1
    date is a MySQL Reserved Word. Please try to avoid using it as column name. Commented Jul 14, 2017 at 10:11
  • show your html and form Commented Jul 14, 2017 at 10:11
  • The connection to the database is successful because the code in my connect.php shows that. It is just something related to this page's code Commented Jul 14, 2017 at 10:24

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.