this error keep showin up after clickin submit
ERROR: Form data not submitted.
this is the form
<form action="connection.php" method="post">
<p>
<label for="firstName">First Name:</label>
<input type="text" name="first_name" id="firstName" required>
</p>
<p>
<label for="lastName">Last Name:</label>
<input type="text" name="last_name" id="lastName" required>
</p>
<p>
<label for="Gender">Gender:</label>
<input type="text" name="gender" id="Gender" required>
</p>
<p>
<label for="Address">Address:</label>
<input type="text" name="address" id="Address" required>
</p>
<p>
<label for="emailAddress">Email Address:</label>
<input type="email" name="email" id="emailAddress" required>
</p>
<input type="submit" value="Submit">
</form>
and this is my php script
<?php
// Check if the form data is set
if (isset($_POST['first_name']) && isset($_POST['last_name']) && isset($_POST['gender']) &&
isset($_POST['address']) && isset($_POST['email'])) {
// Database connection
$conn = mysqli_connect("localhost", "root", "", "form_data_db");
// Check connection
if ($conn === false) {
die("ERROR: Could not connect. " . mysqli_connect_error());
}
// Taking all 5 values from the form data (input)
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$gender = $_POST['gender'];
$address = $_POST['address'];
$email = $_POST['email'];
// Performing insert query execution
$sql = "INSERT INTO form_data (first_name, last_name, gender, address, email)
VALUES ('$first_name', '$last_name', '$gender', '$address', '$email')";
if (mysqli_query($conn, $sql)) {
echo "<h3>Data stored in the database successfully.</h3>";
echo nl2br("n$first_namen $last_namen $gendern $addressn $email");
} else {
echo "ERROR: Hush! Sorry $sql. " . mysqli_error($conn);
}
// Close connection
mysqli_close($conn);
} else {
echo "ERROR: Form data not submitted.";
}
?>