Jump to content

No data captured after submission of the form


genzedu777

Recommended Posts

Hi guys,

 

I need some help in my coding, I have submitted the form, and basically I should see the success msg, which is echo '<p>Your new account has been successfully created. You\'re now ready to <a href="login.php">log in</a>.</p>'. However it wasnt appearing, and when I look into my database, I couldnt find any record which I have registered, is there something amiss in my coding? Please help, Thanks

 

 

<?php

  require_once('123.php');

 

  // Connect to the database

  $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME)

  or die(mysql_error());

 

  if (isset($_POST['submit'])) {

    // Grab the profile data from the POST

    $name = $_POST['name'];

$email = $_POST['email'];

    $password = $_POST['password'];

$location = $_POST['location'];

$dob = $_POST['dob'];

$category = $_POST['category'];

 

        $query = "INSERT INTO practice_user (name, email, password, location, dob, category, join_date) " .

"VALUES ('$name, $email', $password, $location, $dob, $category, NOW())";

        mysqli_query($dbc, $query)

or die(mysql_error());

 

        // Confirm success with the user

        echo '<p>Your new account has been successfully created. You\'re now ready to <a href="login.php">log in</a>.</p>';

 

        mysqli_close($dbc);

}

?>

Link to comment
Share on other sites

Your query is poorly formed, you should be getting an error.

 

Your query should be....

 

$query = "INSERT INTO practice_user (name, email, `password`, location, dob, category, join_date) VALUES ('$name', '$email', '$password', '$location', '$dob', '$category', NOW())";

 

Make sure you also escape any user inputed data using mysqli_real_escape_string.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.