Form is used to send the information to website.
There is two method GET & POST. By Default it is GET method, if you don't specify in method attribute.
Both method have their own advantage & disadvantage.
There is two method GET & POST. By Default it is GET method, if you don't specify in method attribute.
Both method have their own advantage & disadvantage.
GET Method
Advantage of GET method
- Data is visible in Address Bar (URL), when form is submit through GET method.
- As data is visible in URL, It good for search. when can copy URL and past in address bar then he need not to re-select the option for submit.
- Access through $_GET (SUPER GLOBAL variable ) in PHP
- Access through $_REQUEST (SUPER GLOBAL variable )
Disadvantage of GET method
- Data is visible in Address Bar (URL), sometimes when don't want to let the user to know what we are sending in form like checkout page.
- It has limit 2KB, you can't send more than 2 KB
- Data is not secured as visible in address bar.
- Can't Access data with $_POST
- you cannot send file with GEt Method.
POST Method
Advantage of POST method
- Data is not visible in Address Bar, when form is submit through POST method.
- Data is more secure in POST method as compare to GET method.
- Access through $_POST (SUPER GLOBAL variable ) in PHP.
- Access through $_REQUEST (SUPER GLOBAL variable ).
- You can send file like image, zip file in POST Method.
- By Default "php_value post_max_size" is 8MB, but we can increase it from php.ini file
No comments:
Post a Comment