In this lesson you will learn the difference between POST and GET and when to use each of them and what is the main purpose and main functionality of each of them.
This Is Visual Explain of the Same Post:
Form Method Attribute
The method
attribute specifies the HTTP method (GET or POST) to be used when submitting the form data.
Example:
<form action="/safhatech.php" method="get">
or
<form action="/safhatech.php" method="post">
When to Use GET?
GET is the default method of html when submitting form data. However, when GET is used, the submitted form data will be visible in the page address field. so it is less secure.
Wen you use GET focus on the following:
Appends form-data into the URL in name/value pairs
URL length is limited (about 3000 characters)
Less secure so never use GET to send sensitive data! (will be visible in the URL)
Useful for form submissions where a user wants to bookmark the result
GET is better for non-secure data, like query strings in Google
When to Use POST?
Use POST if the form data contains sensitive, secure or personal information. POST method does not display the submitted form data in the page address field means more secure.
Wen you use POST focus on the following:
POST size is not limited, so it can be used to send large amounts of data.
Form submissions with POST cannot be bookmarked
Organize Form Data with <fieldset> Tag
The <fieldset>
element is used to group related data in a form. The <legend>
element defines a caption for the <fieldset>
element.
Example:
<form action="/safhatech.php">
<fieldset>
<legend>safhatech form:</legend>
Name:<br>
<input type="text" name="Name" ><br>
Company:<br>
<input type="text" name="Company" ><br>
<input type="submit" value="Send">
</fieldset>
</form>
Result in Browser:
This lesson is one of the HTML5 for deep understanding course. where we will learn every common elements from basic to the advanced element.
In addition each lesson has a video which you could visit and watch for more practicing and for deep understanding.
We hope that we could give the best for you and for the deep and easy understanding.
You could follow the series from our website SAFHATECH.com and go to categories and then programming and then Choose the course you want then just click next lesson to go step by step.
Finally we hope every thing is works as you suspect.
Consequently You could follow us at :
Website URL: https://www.safhatech.com/
Youtube: https://www.youtube.com/channel/UCIVzh6iykNowNcOUT5Gfasw
Twitter: http:// https://twitter.com/safhatech
Instegram: https://www.instagram.com/safhatech
Facebook: http:// https://www.facebook.com/Safhatech-487171875443687
Phone:967772223681
References: http://www.w3schools.com