I have a very quick question, and the answer can be a case to case basis, but over all what do you think is a more efficient way of passing values from the front end to the back end. From client to php. Would it be better to pass it through a form or through the url? I know security is a big plus for form values, but is it more efficient? Which is faster? I hope the question makes sense. Thanks Guys.
3 Answers
i think either way it has the same level of security. even if you send it via a form with the post method it is still visible if you check the http header.
i think that passing via GET (url) there is a limit on the amount of data and that it is smaller than the limit with POST(you call it form). if you pass using GET(url) it will be more SEO friendly and it can give users a way of bookmarking or returning to a specific state or page.
you should look when-do-you-use-post-and-when-do-you-use-get
Both
POST
(in this case, from the form) andGET
requests are fully visible through headers and/or the URL, i.e., equally poor securityYou can claim that
GET
requests are a little bit more accessible for manipulation via their visibility (for novice users)There is a huge size limit difference in the two request types: ~2K (
GET
, dependent on browser and server) vs. "unlimitied" (POST
, configured on the server)POST
should be used when the request is non-idempotent, i.e., when it causes a change in server state each time it is performed (more) 1. Corollary, aGET
request should cause no side-effects (idempotent or even nullipotent).A
GET
request contains all data in the URL, therefore it can be bookmarked.
More information is available in URIs, Addressability, and the use of HTTP GET and POST by the W3C
1) This is often the cause for the "the browser asks to re-submit my data" type of questions.

- 31,109
- 6
- 81
- 98
-
Nice answer, it gives the core meaning of GET and POST – kazinix Aug 03 '11 at 06:32
Take note that GET request is used to request data and POST request is used to change server data/state. Typing URL is also a GET request so it really depends on what a client is doing, is he requesting for a data? or he wants to change data? Now, in case of using GET, is the parameter (?name=value&name2=value) will be gathered from user? if yes, then use form, if no, use hyperlinks.
Which is faster? If you use form (GET method), the browser will have to process the user input to construct the URL. If the user just type the URL on address bar, or he followed a link, then it will be faster, the browser will just try to reach that URL.

- 28,987
- 33
- 107
- 157