Please Login or Register to continue.


I have watched your video tutorial. I have done the same and checked each and every code line in PHP. Here is my PHP file code in which I have created a form to save(insert) data into the MySQL database. 




<!DOCTYPE html>






<form action="" method="POST">



<tr><td><input type="text" name="name" ></td></tr>


<tr><td><input type = "email" name="email"></td></tr>


<tr><td><input type = "mobile" name="mobile"></td></tr>


<tr><td><input type = "date" name="date"></td></tr>

<tr><td><input type = "submit" name="submit"></td></tr>










    $result = mysqli_query($mysqli,"INSERT into record values('','$name','$email','$mobile','$date')");



    echo "Success";




    echo "Failed";






and config.php file..

$dbhost = 'localhost';
$dbname = 'engi';
$dbusername = 'root';
$dbpass = '';

I have used the name engi and table name record. 

If I submit data by pressing a button, it gives me nothing error or data doesn't save into the MySQL database. 


(150 Points)
in PHP


1 Answer
(7.3K Points)

Data saving is another method of PHP programming in which you should have knowledge about connection file, MYSQL inserts query and HTML form then you will be able to save or insert database into the MYSQL database using PHP. I have checked your code and want to say about your query and connection. You are getting errors from your connection code because dB pass is not correct with empty value. I think you are getting errors or your server is not displaying any errors. You are missing a double quotation mark. 

$dbpass = '' ";

I can check that you are using single quotes. The standard of PHP says you use a single quotation mark. 

$dbpass = ' ';

If you want to save HTML form data into MySQL database using PHP then you should use the INSERT query. I think you have an id auto-increment. 

The same pattern is missing here.  Let's discuss it. I think you are missing a single quotation mark in your query. 

$result = mysqli_query($mysqli,"INSERT INTO record VALUES (' ','$name','$email','$mobile','$date')");

Now, check your code and make it correct and execute. 

I have other tutorials for you. 

Insert data and display in HTML table using PHP 

Insert(Signup) form in PHP 



Related Questions :-

Featured Items:-

Certificate system in PHP website | PHP scripts


Home Credito loan finance management multipurpose system in PHP


Result management system with Marksheet in PHP website | PHP Scripts


Your Answer

You can post your answer after login..