Passing Information between pages
From Wiki
Some of the below information is not specific to PHP but is a consequence of the PHP/HTML interaction or of the HTTP protocol itself.
- The most important thing to recall about the way the Web works is that the HTTP protocol itself is stateless. This means that each HTTP request - in most cases, this translates to each resource (HTML page, jpg file,style sheet, and so on) being asked for and delivered - is independent of all the others, to not knows nothing essential about the identity of the client, and has no memory.
- Each request initiate a discrete process, which serve up one single solitary file and then is automatically killed off. Even if you design your site with very strict one-way navigation (Page1 leads only to Page2, which leads only to Page3, and so on), the HTTP protocol will never know or care that someone browsing Page2 must have come from Page1. You cannot set the value of a variable on Page1 and expect it to be imported to Page2 by the exigencies of HTML itself.
- You can use HTML to display a form, and someone can enter some information using it-but unless you employ some extra means to pass the information to another page or program, the variable will simply dissapear as soon as you move to another page.This is where a form-handling technology like PHP comes in. PHP will catch the variable tossed from one page to the next and make it available for further use. PHP happens to be unusually good at this type of data-passing function, which makes it fast and easy to employ for a wide variety of Web site tasks.
The GET Method
The get method passes arguments from one page to the next as part of the URL query string. When used for form handling, get appends the indicated variable name(s) and value(s) to the URL designated in the action attribute with a question mark separator and submits the whole thing to the processing agent (in this case a Web server).
The POST Method
POST is the preferred method of form submission today, particularly in nonidempotent usages (those that will result in permanent changes), such as adding information to a database. The form data set is included in the body of the form when it is forwarded to the processing agent (in this case, PHP). No visible change to the URL will result according to the different data submitted.
Advantages:
- It is more secure than get because user-entered information is never visible in the URL query string, in the server logs, or (if precautions, such as always using the password HTML input type for passwords, are taken) on screen.
- There is a much larger limit on the amount of data that can be passed (a couple of kilobytes rather than a couple of hundred characters).
Disadvantages:
- The results at a given moment cannot be bookmarked.
- The results should be expired by the browser, so that an error will result if the user employs the Back button to revisit the page.
- This method can be incompatible with certain firewall setups, which strip the form data as a security measure.

