03-09-2003, 08:11 AM
i know that the method attribute controls the way that the information is sent to the server, as illustrated bellow:
<FORM ACTION = "NextPage.php" METHOD = GET>
<FORM ACTION = "NextPage.php" METHOD = POST>
the question is: which one should i use and why?
well, I always use POST as
1. the data doesn't appear in the url.
2. there are higher size restrictions on data passed (get restricts you to 256bytes)
03-09-2003, 01:48 PM
I agree, but there are some cases where using GET seems more appropriate:
1. It makes the result page bookmarkable and linkable to. Look at Google for example.
2. Because the GET variables appear in the URL, that allows users to navigate between pages using the back and forward button, without having to resubmit form values.
03-09-2003, 06:10 PM
Originally posted by Íkii
(get restricts you to 256bytes)
It'a actually 4K in most modern browsers.
03-09-2003, 09:15 PM
It makes the result page bookmarkable and linkable to. Look at Google for example.
what is meaning of bookmarkable and linkable?
03-09-2003, 09:26 PM
http://www.codingforums.com/showthread.php?s=&threadid=15986 is a typical URL used from a GET method, if this was done using POST, it would probably be
Making it hard to bookmark or link to the correct thread
03-11-2003, 03:08 PM
i didn't understand :confused:
03-11-2003, 03:52 PM
What exactly did you not understand?
The difference is that with GET variables are passed per URL. That means that they appear in the URL, and if you copy-and-paste that URL e.g. into another browser window, you will still get to the correct result page.
The first one could be a result page that handles form data submitted with the POST method. But the URL does not indicate that, if you type this URL (http://www.example.com/result.php) into your browser's location bar, you get to the requested document, but it might not be exactly the same because in this case no POST variables were submitted by you.
Whereas the second URL, typed into a location bar, will *still* bring you exactly the same result page. Just try to bookmark a search result page of google, you see the difference.
03-11-2003, 05:07 PM
Just try to bookmark a search result page of google, you see the difference.
what does bookmark here mean? and how can i bookmark a search result page?
03-11-2003, 05:20 PM
In Mozilla, when you are on the search result page, you just chose from the menu
Bookmarks -> Bookmark this Page
Maybe in your browser the language version is non-english and it's called something different than "bookmark", but then the PHP forums are not the right place to ask how to use the browser...