As most of you already know, these two are used for form processing method. For example, you may see their usage like;
<form method=”get” action=”page.php”>
or
<form method=”post” action=”page.php”>
- When you use get method, the submitted data will be passed to another page by encoding them into a URL. Taken from the HTML 4.0 specification quotation;
- If the method is “get” – -, the user agent takes the value of action, appends a ? to it, then appends the form data set, encoded using the application/x-www-form-urlencoded content type. The user agent then traverses the link to this URI. In this scenario, form data are restricted to ASCII codes.
- Meaning, when the form is submitted, the URL of the page where you’re passing the data to will appended with all the data.
- OK. In the previous example, we’re passing the form to a page called page.php. So, our URL will be something like;
http://website.com/
page.php?data1=blabla&data2=blalabla
- So when you want retrieve those data from the page.php, you must use the $_GET method. For example if you want to retrieve data2 value;
- Using get method limits the length of data that can be sent. It’s also not a good practice especially when sensitive data like password are being passed. But in certain cases, it’ll make it easier for bookmarking purpose.
- When you use post method, the submitted data will be passed to another page “behind the scene” by putting them in standard input. Taken from the HTML 4.0 specification quotation;
- If the method is “post” –, the user agent conducts an HTTP post transaction using the value of the action attribute and a message created according to the content type specified by the enctype attribute.
- This means cleaner adress bar, lol. So, if you want to retrieve the submitted data from the page.php, you must use the $_POST method. For example if you want to retrieve data1 value;
- Using post method is a good practice for a secure data passing. Plus, more data can be passed ;) The disadvantages is of course, the page can’t be bookmark.

ajwa . Naj . Wawa . 27 . 











