Passing Informationbetween PagesIn this (Web site designers) chapter, we ll briefly discuss
Passing Informationbetween PagesIn this chapter, we ll briefly discuss some things you need to knowabout passing data between Web pages. Some of this information isnot specific to PHP but is a consequence of the PHP/HTML interac- tion or of the HTTP protocol itself. HTTP Is StatelessThe most important thing to recall about the way the Web works isthat the HTTP protocol itself is stateless. If you are a poetic soul, youmight say that each HTTP request is on its own, with no directionhome, like a complete unknown . . . you know how the rest goes. For the less lyrical among us, this means that each HTTP request inmost cases, this translates to each resource (HTML page, .jpg file, style sheet, and so on) being asked for and delivered is indepen- dent of all the others, knows nothing substantive about the identityof the client, and has no memory. Each request spawns a discreteprocess, which goes about its humble but worthy task of serving upone single solitary file and then is automatically killed off. (But thatsounds so harsh; maybe we can say flits back to the pool of avail- able processes instead.) Even if you design your site with very strict one-way navigation (Page1 leads only to Page 2, which leads only to Page 3, and so on), theHTTP protocol will never know or care that someone browsing Page 2must have come from Page 1. You cannot set the value of a variableon Page 1 and expect it to be imported to Page 2 by the exigencies ofHTML itself. You can use HTML to display a form, and someone canenter some information using it but unless you employ some extrameans to pass the information to another page or program, the variable will simply vanish into the ether as soon as you move toanother page. This is where a form-handling technology like PHP comes in. PHP willcatch the variable tossed from one page to the next and make it avail- able for further use. PHP happens to be unusually good at this type ofdata-passing function, which makes it fast and easy to employ for awide variety of Web site tasks. 77CHAPTER …In This ChapterHTTP is statelessGET argumentsA better use for GET-style URLsPOST argumentsFormatting formvariablesPHP superglobal arraysExtended example: calculator …
You need excellent and relaible webhost company to host your web applications? Then pay a visit to Inexpensive Web Hosting services.