how to insert data in the database using php and mysqli

Hello guys, Today we are learning MYSQLI INSERT QUERY execute in the database using php with mysqli. Then lets start.

Originally published at - 14 Mar 2019 04:45 pm

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">


2. PHP Source Code(send.php)


$conn=mysqli_connect("localhost", "root", "", "testproject");


$query=mysqli_query($conn, "INSERT INTO userdetails(name) VALUES('$name')");


echo"Successfully Inserted";



echo"Inserted Failed";