The Wayback Machine - https://web.archive.org/web/20081201135041/http://www.webreference.com/html/tutorial30/4.html


spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / html / tutorials / 30 / 4

index1234567

HTTP for HTML Authors, Part III

Developer News
Mandrake Linux Founder Back, Virtually
Amazon: We're a Technology Company
Sun Expands MySQL With Closed Source

Form submission through HTTP

Back in Tutorial 13, when I explained HTML forms, I made a brief mention of how they are submitted. That was when you where first introduced to the difference between GET and POST.

Now you know that GET and POST are really two different HTTP request methods. We've already covered the GET method in part I; it simply involves getting a URL. When a form is submitted using the GET method, the submitted data is part of the URL; the browser just encodes the data and tags it on to the end as a query string. What the Web server does with it after this is its own affair.

GET queries are considered antiquated by many, since they have many shortcomings (you can't use characters other than those in ISO-8859-1, for instance, and you usually can't have a URL longer than 1024 bytes), but they do have one distinct advantage: They can be linked to. A POST query is more than just a URL, it is a URL plus a piece of data, so you can't link to a POST query using an A or LINK element, nor can you bookmark it for later use. This is important for form submissions that don't actually change anything. A Web search on a search engine is a good example. The result of the query is a resource; it might be a changing resource as different results may be returned at later times, but it still identifies the set of Web pages that matched your search query. On the other hand, if a form is used to send an e-mail as described above, you won't want to link to it or bookmark it since every time someone follows the link an e-mail will be sent without any confirmation.

POST queries are more sophisticated, but cannot be linked to. As we saw in the mail example above, this can be a blessing; you don't want all kinds of requests being linked to like this. On the other hand, POST queries can cause several problems. For example, take the press release example I mentioned earlier. Let's assume that Acme offers a form so that users can view press releases by selecting a date and title in a form, and then returns the press release after the form is submitted. Let's assume the form's ACTION atribute is the following URL:

http://www.acme.com/news/pressrelease

If this form uses the POST method, the user will get to the press release but the URL shown by his browser, as well as the one used when bookmarking the search, will be the one shown above, which unfortunately does not coincide with the URL that points to the article. Using GET instead, the URL will be something like:

http://www.acme.com/news/pressrelease?year=2000&month=1&day;=14&title;=foobar

This can then be used to link directly to the press release from anywhere in the Web.

index1234567

Next Page...

http://www.internet.com/

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Copyright 2008 Jupitermedia Corporation All Rights Reserved.

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Whitepapers and eBooks

Intel Whitepaper: Comparing Two- and Four-Socket Platforms for Server Virtualization
IBM Solutions Brief: Go Green With IBM System xTM And Intel
HP eBook: Simplifying SQL Server Management
IBM Contest: Are You the Next Superstar? Join the "Search for the XML Superstar" Contest to Find Out
Microsoft PDF: Top 10 Reasons to Move to Server Virtualization with Hyper-V
Microsoft PDF: Six Reasons Why Microsoft's Hyper-V Will Overtake Vmware
Microsoft Step-by-Step Guide: Hyper-V and Failover Clustering
Intel PDF: Quad-Core Impacts More Than the Data Center
Intel PDF: Virtualization Delivers Data Center Efficiency
Go Parallel Article: PDC 2008 in Review
Microsoft PDF: Top 11 Reasons to Upgrade to Windows Server 2008
Avaya Article: Communication-Enabled Mashups: Empowering Both Business Owners and IT
Intel Whitepaper: Building a Real-World Model to Assess Virtualization Platforms
  PDF: Intel Centrino Duo Processor Technology with Intel Core2 Duo Processor
Microsoft Article: Build and Run Virtual Machines with Hyper-V Server 2008
Go Parallel Article: Q&A; with a TBB Junkie
IBM Whitepaper: Innovative Collaboration to Advance Your Business
Internet.com eBook: Real Life Rails
IBM eBook: The Pros and Cons of Outsourcing
Internet.com eBook: Best Practices for Developing a Web Site
IBM CXO Whitepaper: The 2008 Global CEO Study "The Enterprise of the Future"
Avaya Article: Call Control XML in Action - A CCXML Auto Attendant
IBM CXO Whitepaper: Unlocking the DNA of the Adaptable Workforce--The Global Human Capital Study 2008
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
HP eBook: Guide to Storage Networking
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
webref The latest from WebReference.com Browse >
Popular JavaScript Framework Libraries: An Overview - Part 3 · Accessing Your MySQL Database from the Web with PHP · Working with the DOM Stylesheets Collection
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Crucial Triples Up With New Three-Channel DDR3 Kits · Meet the Finalists: Excellence in Technology Awards · Tealeaf Offers Insight to Mobile Customer Behavior

URL: http://www.webreference.com/html/tutorial30/4.html

Produced by Stephanos Piperoglou
Created: March 15, 2001
Revised: March 16, 2001

Morty Proxy This is a proxified and sanitized view of the page, visit original site.