Member-only story

How to insert HTML form data into MySQL database using PHP

Bipsmedium
3 min readApr 10, 2020

--

In this tutorial, we will learn how to insert HTML form data into the MySQL database using PHP. we need to know the basic overview of some superglobal variables in PHP. There are some variables, we can access from anywhere in the PHP script that is called superglobal variables. Some of them are defined as follows — —

1. $_SERVER: It is a global variable that holds information about headers, paths, host address, script locations, etc. such as
. $_SERVER[‘PHP_SELF’] = Returns the filename of the currently executing script.
. $_SERVER[‘SERVER_ADDR’] = Returns the IP address of the host server.
. $_SERVER[‘SERVER_NAME’] = Returns the name of the host server such as www.ndtv.com

. $_SERVER[‘REQUEST_METHOD’] = Returns the request method used to access the page.

2. $_REQUEST: It is a superglobal variable that collects data from a form after clicking the submit button.

3. $_POST: It is a global variable that is used to send form data to the server. Data sent from a form with $_POST method is invisible to others. POST method is used to send sensitive information like username and password etc.

--

--

Bipsmedium
Bipsmedium

Written by Bipsmedium

Hi, This is Biplab and I am a PHP laravel developer and other open source technologies. I am here to share my experience with the community.

No responses yet