SitePoint Sponsor |
|
User Tag List
Results 1 to 7 of 7
-
Feb 6, 2001, 03:18 #1
- Join Date
- Feb 2001
- Posts
- 140
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hi, I have a page that contains a GET and a POST form. What are the differences between these two.
<FORM ACTION="index.php3" TYPE=POST>
<FORM ACTION="index.php3" TYPE=GET>
Also, I have noticed there's a hidden variable, called SUBMIT, when a POST form gets submitted. Am I right?
What will be the results when no 'TYPE' is defined? Like this one, <FORM ACTION="index.php3">
Thanks for answering my questions...
-
Feb 6, 2001, 06:03 #2
- Join Date
- Jul 2000
- Location
- 80,000 feet below the surface
- Posts
- 1,442
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
A couple of things. Technically speaking it should be method not type when differentiating between GET and POST (just so your form actually works when submitting information!
)
You are correct with regards to the hidden variable SUBMIT.
It is highly recommended that you put the 'METHOD="post/get' in. Otherwise the form won't know what to do with it and the form gets 'reset' (and all information is lost!)
The difference between POST and GET :
POST : sends the inputted information to the web server as a 'transaction message body'.
GET : sends the inputted information to the web server appended to the URL (like sitepoint.com/cgi-bin/formmail?name=bc&stuff=iloveyoursite&time=1230GMT etc.)
The GET method is deprecated in HTML 4.0, but don't worry about that
Hope that clears it up a bit.
-
Feb 6, 2001, 06:14 #3
- Join Date
- Feb 2001
- Posts
- 140
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
So, if a form doesn't contain either POST or GET, will the server see it as a POST or GET?
Also, can I emulate a URL generated by a POST form?
If so, will this URL suffice?
http://www.domain.com/index.php3?x=1&SUBMIT
I have appended the SUBMIT to the URL above.
Thanks.
-
Feb 6, 2001, 06:37 #4
- Join Date
- Jul 2000
- Location
- 80,000 feet below the surface
- Posts
- 1,442
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
If you don't include a POST or GET, the server will not be able to send the info and you lose all information you inputted in 5 minutes earlier. I just did a bit of reading and I can confirm you must have a POST or GET method specified in the <FORM> tag; otherwise nothing will happen at all (apart from losing the info).
With regards to appending the 'SUBMIT', you can try it but I'm rather doubtful it will work.
-
Feb 6, 2001, 06:40 #5
- Join Date
- Dec 2000
- Location
- Horsham, West Sussex, UK
- Posts
- 277
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
aditionally...
if you use GET then you can bookmark the page without any problems.
but with POST you woulnd be able to bookmark the rusult from a sear for example.
at least i think i'm right.DIEGO MOORE
-
Feb 6, 2001, 06:45 #6
- Join Date
- Jul 2000
- Location
- 80,000 feet below the surface
- Posts
- 1,442
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
That's correct.
-
Feb 6, 2001, 08:57 #7
- Join Date
- Mar 2000
- Location
- Muskegon, MI
- Posts
- 2,328
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Nowadays, it seems the GET method is used more for URL redirection. If page content is retrieved dynamically from a database, a single page can be used to display multiple records, i.e. mysite.com/index.cfm?pageID=newmembers
Whereas, the post method is used for form submission.
Bookmarks