1<!DOCTYPE html>
2<html>
3<head>
4 <title>Add Records in Database</title>
5</head>
6<body>
7
8<?php
9include "dbConn.php"; // Using database connection file here
10
11if(isset($_POST['submit']))
12{
13 $fullname = $_POST['fullname'];
14 $age = $_POST['age'];
15
16 $insert = mysqli_query($db,"INSERT INTO `tblemp`(`fullname`, `age`) VALUES ('$fullname','$age')");
17
18 if(!$insert)
19 {
20 echo mysqli_error();
21 }
22 else
23 {
24 echo "Records added successfully.";
25 }
26}
27
28mysqli_close($db); // Close connection
29?>
30
31<h3>Fill the Form</h3>
32
33<form method="POST">
34 Full Name : <input type="text" name="fullname" placeholder="Enter Full Name" Required>
35 <br/>
36 Age : <input type="text" name="age" placeholder="Enter Age" Required>
37 <br/>
38 <input type="submit" name="submit" value="Submit">
39</form>
40
41</body>
42</html>
43