<?php
include "config.php";
if(isset($_POST['submit'])){
$name=$_POST['name'];
$address=$_POST['address'];
$age=$_POST['age'];
$querin="INSERT INTO `teacherdetails` (`name`,`address`,`age`) VALUES ('$name','$address','$age')";
$resul= $conn->query($querin);
if(resul==True)
{
echo "NEW RECORD ADDED TO THE TABLE";
}
else{
echo "ERROR WHILE INSERTING".$query."<br>".$conn->error;
}
echo $conn->error;
$conn -> commit();
$conn ->close();
}
?>
<!DOCTYPE html>
<html>
<body>
<form action="view.php" method="POST">
<fieldset>
<legend>Enter the details</legend>
<label for="name">Name:</label>
<input type="text" id="name" name="name">
<label for="address">Address:</label>
<input type="text" id="address" name="address">
<label for="age">Age:</label>
<input type="number" id="age" name="age">
<input type="submit" value="submit" name="submit"/>
</fieldset>
</form>
</body>
</html>

