It is 3rd day I am unable to send data to MySQL.
here are the resources
db name: school
table name: staff
connection.php contains
<?php
$db = mysqli_connect('localhost', 'root', '', 'school') or die("Unable to connect to MySQL");
?>
and add-teacher.php contains
<form method="post" action="add-teacher.php" >
<input type="text" name="firstname" />
<input type="text" name="lastname" />
<input type="submit" name="submit" value="Confirm" />
</form>
<?php
if (isset($_POST['submit'])) {
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$query = "INSERT INTO `staff` (`fname`, `lname`) VALUES ('$firstname', '$lastname')";
if (!mysql_query($query)) {
die("DAMMIT");
} else {
echo "Success";
}
}
?>
I could not fins any error despite no row found at phpmyadmin.
add-teacher.php: