1. HTML Source Code(Index.php)

<form action="send.php" method="post">
<input type="text" name="name" palceholder="Enter name">
<input type="submit" name="submit" value="Submit">
</form>

2. PHP Source Code(send.php)

<?php
$conn=mysqli_connect("localhost", "root", "", "testproject");
$name=$_POST["name"];
$query=mysqli_query($conn, "INSERT INTO userdetails(name) VALUES('$name')");
if(query==true){
echo"Successfully Inserted";
}
else{
echo"Inserted Failed";
}
?>