Question
please solve the problem the problem is: a database is created but firstname,lastname, email, phone , message infomration is not added to the database. I
please solve the problem
the problem is: a database is created but firstname,lastname, email, phone , message infomration is not added to the database.
I have a correct html with correct action methods.
if (empty($username)){ if (empty($password)){
$host = "localhost"; $dbusername = "root"; $dbpassword = ""; $dbname = "contactdata"; // Create connection $conn = new mysqli ($host, $dbusername, $dbpassword, $dbname,"3308"); if (mysqli_connect_error()){ die('Connect Error ('. mysqli_connect_errno() .') ' . mysqli_connect_error()); } else{
$sql = "INSERT INTO contactdata (firstname, lastname,phone,email,message) values ('$firstname','$lastname','$phone','$email','$message')";
if ($conn->query($sql)){ echo "New record is inserted sucessfully"; } else{ echo "Error: ". $sql ." ". $conn->error; } $conn->close(); } } else{ echo "Password should not be empty"; die(); } } else{ echo "Username should not be empty"; die(); } ?>
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started