<?php
if (isset($_POST['submit'])) {
$name = $_POST['name'];
$email = $_POST['email'];
$sql = "INSERT INTO your_table_name (name, email) VALUES ('$name', '$email')";
if ($con->query($sql) === TRUE) {
echo "Data inserted successfully.";
} else {
echo "Error: " . $con->error;
}
}
$con->close();
?>
<!DOCTYPE html>
<html>
<head>
<title>Insert Data</title>
</head>
<body>
<form method="post">
<label for="name">Name:</label>
<input type="text" name="name" id="name" required>
<br>
<label for="email">Email:</label>
<input type="email" name="email" id="email" required>
<br>
<input type="submit" name="submit" value="Insert Data">
</form>
</body>
</html>