Header ads

How to Insert Form Data into MySQL Database using PHP ?

Insert Data into MySQL Database using PHP 




In this article, we will store information in data set which is submitted through HTML structure.

HTML structure: First we make a HTML structure that needs to take User input from . HTML structure is a record which stores data of a user on a web server utilizing intelligent controls. A HTML structure contains distinctive sort of data, for example, username, password, contact number, email id and so forth.

The components that are utilized in a HTML structure are check box, input box, radio catches, submit catches and so forth With the assistance of these components, the data of a user is submitted on the web server.

Index.php Code:


Now Create a database and a table inside it.


Complete Steps to Create Database and a Table:

 

  • Start Wamp Server.
  • Open localhost/phpmyadmin in your web browser.
  • Create database of name data and table of name student.



Now we must need to connect with the database.

dbconnect.php





How to get form data: 

We are going to collect the form data submitted through HTML form. PHP $_POST method is a PHP super global variable which is used to collect data after submitting the HTML form.

forminsert.php




Note : If you want your password to be encrypted, then Instead of  $password=$_POST['psw'] you have to use $password=md5($_POST['psw']).


And, finally we need a home page 

home.php



For Details Visit YouTube Channel : Techno Junkie  

Post a Comment

0 Comments