genzedu777 Posted September 27, 2010 Share Posted September 27, 2010 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); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/214505-no-data-captured-after-submission-of-the-form/ Share on other sites More sharing options...
trq Posted September 27, 2010 Share Posted September 27, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/214505-no-data-captured-after-submission-of-the-form/#findComment-1116203 Share on other sites More sharing options...
genzedu777 Posted September 27, 2010 Author Share Posted September 27, 2010 Hi Thorpe, Thank you so much for the advice. However where do I normally place the mysqli_real_escape_string()? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/214505-no-data-captured-after-submission-of-the-form/#findComment-1116207 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.