Hi I am having an error in my code.
What im trying to do is make a contact form where users input their information (Firstname, Lastname, PhoneNo, Email, and Message) then it gets sent to my database on phpmyadmin (called contactform) and their information should then show up on the table (contact-data) showing name, id, email address, the message etc.
However the error im getting is this
Fatal error: Uncaught mysqli_sql_exception: Unknown column 'message' in 'field list' in C:\xampp\htdocs\form\form-process.php:6 Stack trace: #0 C:\xampp\htdocs\form\form-process.php(6): mysqli->query('INSERT INTO `co...') #1 {main} thrown in C:\xampp\htdocs\form\form-process.php on line 6
and here is my code from the process.php and the config.php (which is supposed to connect to the database)
Process -
<?php
include("config.php");
extract($_POST);
$sql = "INSERT INTO `contact-data`(`firstname`, `lastname`, `phone`, `email`, `message`) VALUES ('".$firstname."','".$lastname."',".$phone.",'".$email."','".$message."')";
$result = $mysqli->query($sql);
if(!$result){
echo "Couldn't enter data".$mysqli->error;
}
echo "Thank You For Contacting Us ";
$mysqli->close();
?>
Confrig-
<?php
define("DB_HOST","localhost");
define("DB_USER","root");
define("DB_PASSWORD","");
define("DB_NAME","contactform");
$mysqli = new mysqli(DB_HOST,DB_USER, DB_PASSWORD,DB_NAME);
?>