how to insert data into mysql using php

<?php

session_start();
$connect=mysqli_connect(“localhost”,”root”,”root”,”sales”);

if ($connect!=true){
echo “everything is not ok”.mysqli_connect_error();

}
else {
echo “”;
}
$firstname = $_POST[‘f_name’];
$lastname = $_POST[‘l_name’];
$cell_no=$_POST[‘cell_no’];
$h_address=$_POST[‘h_address’];
$b_address=$_POST[‘b_address’];
$email=$_POST[’email’];
$asset_name=$_POST[‘asset_name’];
$asset_value=$_POST[‘asset_value’];
$advance=$_POST[‘advance’];
$tenure=$_POST[‘tenure’];
$installment=$_POST[‘installment’];
$guaranteer_address=$_POST[‘guaranteer_address’];
$guaranteer_no=$_POST[‘guaranteer_no’];

for mysql insert use below query

$firstname = mysqli_real_escape_string($connect, $_POST[‘f_name’]);
$lastname = mysqli_real_escape_string($connect, $_POST[‘l_name’]);
$cell_no=mysqli_real_escape_string($connect,$_POST[‘cell_no’]);
$h_address=mysqli_real_escape_string($connect,$_POST[‘h_address’]);
$b_address=mysqli_real_escape_string($connect,$_POST[‘b_address’]);
$email=mysqli_real_escape_string($connect,$_POST[’email’]);
$asset_name=mysqli_real_escape_string($connect,$_POST[‘asset_name’]);
$asset_value=mysqli_real_escape_string($connect,$_POST[‘asset_value’]);
$advance=mysqli_real_escape_string($connect,$_POST[‘advance’]);
$tenure=mysqli_real_escape_string($connect,$_POST[‘tenure’]);
$installment=mysqli_real_escape_string($connect,$_POST[‘installment’]);
$guaranteer_address=mysqli_real_escape_string($connect,$_POST[‘guaranteer_address’]);
$guaranteer_no=mysqli_real_escape_string($connect,$_POST[‘guaranteer_no’]);

$sql=”INSERT INTO user_info (f_name,l_name,cell_no,h_address,b_address,email,asset_name,asset_value,advance,tenure,installment,guaranteer_address,guaranteer_no)
VALUES (‘$firstname’, ‘$lastname’,’$cell_no’,’$h_address’,’$b_address’,’$email’,’$asset_name’,’$asset_value’,’$advance’,’$tenure’,’$installment’,’$guaranteer_address’,’$guaranteer_no’)”;

$retval = mysqli_query($connect,$sql);
if(! $retval )
{
echo “data is not submitted”.mysql_error();

}
else{
echo “successfully”;
}

mysqli_close($connect);

?>
there just you need to setup first your mysql data with phpmyadmin and create table there with namely user_info and then
create fields there

the html form is down below:

<form role=”form” method=”post” action=”insert.php”>
<div>
<label for=”inputEmail3″>First Name</label>
<div>
<input type=”text” id=”inputEmail3″ placeholder=”Type First Name” name=”f_name” required=”true”>
</div>
<div>
</div>
</div>
<div>
<label for=”inputPassword3″>Last Name</label>
<div>
<input type=”text” id=”inputPassword3″ placeholder=”Type Last Name” name=”l_name” required=”true”>
</div>
<div>
</div>
</div>
<div>
<label for=”inputPassword3″>Cell number</label>
<div>
<input type=”number” id=”inputPassword3″ placeholder=”Type Cell no” name=”cell_no”required=”true”>
</div>
<div>
</div>
</div>
<div>
<label for=”inputPassword3″>Home Address</label>
<div>
<input type=”string” id=”inputPassword3″ placeholder=”Type Home Address” name=”h_address”required=”true”>
</div>
<div>
</div>
</div>
<div>
<label for=”inputPassword3″>Business Address</label>
<div>
<input type=”string” id=”inputPassword3″ placeholder=”Type Business Address” name=”b_address”required=”true”>
</div>
<div>
</div>
</div>
<div>
<label for=”inputPassword3″>Email Address</label>
<div>
<input type=”email” id=”inputPassword3″ placeholder=” Type Email Address” name=”email” required=”true”>
</div>
<div>
</div>
</div>
<h3>Information about Asset:</h3>
<div>
<label for=”inputPassword3″>Asset Name</label>
<div>
<input type=”string” id=”inputPassword3″ placeholder=”Type Asset Name” name=”asset_name” required=”true”>
</div>
<div>
</div>
</div>
<div>
<label for=”inputPassword3″>Asset Value</label>
<div>
<input type=”number” id=”inputPassword3″ placeholder=”Type Asset Value” name=”asset_value” required=”true”>
</div>
<div>
</div>
</div>
<div>
<label for=”inputPassword3″>Advance</label>
<div>
<input type=”number” id=”inputPassword3″ placeholder=”Type Advance” name=”advance” required=”true”>
</div>
<div>
</div>
</div>
<div>
<label for=”inputPassword3″>Installment per month</label>
<div>
<input type=”string” id=”inputPassword3″ placeholder=”Type Installment per month” name=”tenure” required=”true”>
</div>
<div>
</div>
</div>
<div>
<label for=”inputPassword3″>Tenure</label>
<div>
<input type=”number” id=”inputPassword3″ placeholder=”Type Tenure in months” name=”installment” required=”true”>
</div>
<div>
</div>
</div>
<h4>Guaranteer Credentials:</h4>
<div>
<label for=”inputPassword3″>Business Address</label>
<div>
<input type=”string” id=”inputPassword3″ placeholder=”Type Business Address” name=”guaranteer_address” required=”true”>
</div>
<div>
</div>
</div>
<div>
<label for=”inputPassword3″>Cell Number</label>
<div>
<input type=”number” id=”inputPassword3″ placeholder=”Type Cell no” name=”guaranteer_no” required=”true”>
</div>
<div>
</div>
</div>
<div>
<div>
<input type=”submit” value=”Submit”>
</div>
</div>
</form>