PHP MySQL Adding Data in Database

INSERT statement is used to add new data into the table:

INSERT INTO tablename (column1, column2, column3, column4,...) VALUES ('value1', 'value2', 'value3', 'value4',...)

Add records into Profile table HTML file


<form name='profile' method='post' action='profileResult.php'>
Name:<input type='text' name='name'>
Address:<input type='text' name='address'>
<input type='submit' name='submit' value='submit'>

This is PHP file profileResult.php

$servername = "localhost";
$username1 = "root";
$password1 = "";
$dbname = "sample";
//server connection
$connection = mysqli_connect($servername, $username1, $password1, $dbname);
if (!$connection) {
die("Connection failed: " . mysqli_connect_error());
mysqli_query($connection, "INSERT INTO profile (id, name, address) VALUES ( NULL,  '" . $_POST['name'] . "',  '" . $_POST['address'] . "')");