PHP form sending data but SQL shows zeros in all columns.
I checked my code is correct and it prints the result but when I am sending this data to database all the column shows 0 in result. Date of birth is just showing year not complete date.
This is the result of the SQL:
This is my PHP code:
<?php
include('../dbcon.php'); //database included
if (isset($_POST['signup'])) {
$uname = $_POST['uname'];
$email = $_POST['email'];
$fname = $_POST['firstname'];
$lastName = $_POST['lastname'];
$dob = $_POST['dob'];
$gender = $_POST['gender'];
$password = $_POST['password'];
$qry = "INSERT INTO `registration`(`uname`, `email`, `fname`, `lname`, `dob`, `gender`, `password`) VALUES ('$uname','$email','$fname','$lastName','$dob','$gender','$password')" ; //query taken from the select section of sql form registration.
$run = mysqli_query($dbcon, $qry); //run variable for running the query. $dbcon is database variable
if ($run == true) {
echo "data inserted";
}
else
{
echo "error occurred in registration";
}
}
?>