index.php
<DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="css.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,
initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3
/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3
/dist/js/bootstrap.bundle.min.js"></script>
</head>
<title>Hancie Phago</title>
<body>
<div class="container">
<form class="mb-3 mt-3" action="insert.php" method="post">
<div class="row">
<div class="col">
<tr>
<td class="form-label">ID:</td>
<td><input type="text" name="id" class="form-control"
placeholder="ID"></td> </br>
</tr>
<tr>
<td class="form-label">Name:</td>
<td><input type="text" name="name" class="form-control"
placeholder="Name"></td> </br>
</tr>
</div>
<div class="col">
<tr>
<td class="form-label">Age:</td>
<td><input type="number" name="age" class="form-control"
placeholder="Age"></td></br>
</tr>
<tr>
<td class="form-label">DOB</td>
<td><input type="date" class="form-control"
placeholder="dob" name="dob"></td>
</tr>
</div>
<div class="mt-3">
<tr>
<td><input type="submit" class="btn btn-primary"
value="Submit">
</tr>
</div>
</form>
</body>
</html>
insert.php
<?php
$servername="localhost";
$username="root";
$password="";
$dbname="practice";
$conn=new mysqli($servername, $username, $password, $dbname);
if(!$conn){
die ("Could not connect" .mysqli_error());
}
$id=$_POST['id'];
$name=$_POST['name'];
$age=$_POST['age'];
$birth=$_POST['dob'];
$sql="INSERT INTO bio VALUES ('$id', '$name', '$age', '$birth')";
if(mysqli_query($conn, $sql)) {
echo "Recorded success";
}
else {
echo "Error";
}
?>