Home / Web Development / HTML / Data Insert Into MySQL Database – PHP

Data Insert Into MySQL Database – PHP

Hi all,
In here, I will show you to how to insert data into mysql database from php page.

Table Of Content

  1. Create Database
  2. Create Table
  3. HTML Form
  4. HTML Style

insert_values

Create Database

In here, the database is create for performing insert operation. Create database and name it whatever you want.


CREATE DATABASE prittytimes ;

In here ‘prittytimes’ is the database name for creating table. We create table in prittytimes database.

Create Table

Now create table and name it ‘tbl_users’

We create ‘tbl_users’ table in ‘prittytimes’ database. And the tbl_users’ fields are user_id,firstname,lastname,useremail.

HTML Form

html form that inserts user first name , last name and email

HTML Style

HTMl page style is specified in style tag.

Full Code

From the above code we can clearly say that, first we specify the html part for input field like firstname, lastname,useremail. The fields are specified in input tag with name. Next is PHP part, in here first we specify database connection in php page for insert the value from form. Get the input values from form using $_POST[]method. and insert values to database from form field.

Happy coding

If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

Leave a Reply

Your email address will not be published. Required fields are marked *

Social Media Auto Publish Powered By : XYZScripts.com