Working with Forms in HTML and PHP
There are Two HTTP Request Methods: GET and POST. These two methods are used to pass the data between HTML page. To define these methods we have set the method attribute of form tag in HTML as follows:
For POST:
<form method=“post” action=“getdata.php”> </form> For GET:
<form method=“get” action=“getdata.php”> </form>
1) POST Method:
POST method Submits data to be processed to a specified resource.
The query strings (name/value pairs) is sent in the HTTP message body of a POST request as follows:
POST /test/demo_form.php HTTP/1.1
Host: w3schools.com
name1=value1&name2=value2
In above example it shows the POST data passed through HTTP message which contain to
control value as name1 and name2. These values are hidden from user. POST requests are never cached.
POST requests do not remain in the browser history.
POST requests cannot be bookmarked.
POST requests have no restrictions on data length.
So, we can say that POST method is secure and useful then GET.
2) GET Method:
GET method Requests data from a specified resource.
The query strings (name/value pairs) is sent in the URL of a GET request as follows:
/test/demo_form.php?name1=value1&name2=value2
In above example it shows GET method query string which contains control value as name1 and name2. So we can say user can easily get the value from URL.
The query string of GET method is display in the user’s browser URL or address bar
For POST:
<form method=“post” action=“getdata.php”> </form> For GET:
<form method=“get” action=“getdata.php”> </form>
1) POST Method:
POST method Submits data to be processed to a specified resource.
The query strings (name/value pairs) is sent in the HTTP message body of a POST request as follows:
POST /test/demo_form.php HTTP/1.1
Host: w3schools.com
name1=value1&name2=value2
In above example it shows the POST data passed through HTTP message which contain to
control value as name1 and name2. These values are hidden from user. POST requests are never cached.
POST requests do not remain in the browser history.
POST requests cannot be bookmarked.
POST requests have no restrictions on data length.
So, we can say that POST method is secure and useful then GET.
2) GET Method:
GET method Requests data from a specified resource.
The query strings (name/value pairs) is sent in the URL of a GET request as follows:
/test/demo_form.php?name1=value1&name2=value2
In above example it shows GET method query string which contains control value as name1 and name2. So we can say user can easily get the value from URL.
The query string of GET method is display in the user’s browser URL or address bar
Working with Forms in HTML and PHP
Reviewed by Unknown
on
20:48:00
Rating:
No comments: