|
Chapter 11
Other Web Applications
In This Chapter
Passing information from page to page
Using cookies
Using hidden fields in HTML forms
Using PHP session functions
Adding JavaScript to PHP scripts
T
he simplest Web applications collect information from users in HTML forms
and then utilize the information by displaying it, storing it, or usingit in
conditional statements. (Some simple applications are shown in Chapter 10.)
However, Web applications can be much more complex than this. For example,
a shopping cart must collect different types of information; display this infor-
mation; keep track of what users have ordered; calculate prices, taxes, and
shipping; charge credit cards; and perform other tasks. Such complex appli-
cations consist of several scripts that share information. And applications
may also accept complete files from users rather than just information in a
form.
This chapter discusses the basics of these complex Web applications.
Overcoming Statelessness
HTML pages are stateless.That is, HTML pages are independent from one
another. When a user clicks a link, the Web server sends a new page to the
user’s browser, but the browser doesn’t know anything about the previous
page. As far as the browser knows, this could be the first Web page ever in
the history of the world. For static Web pages, where the user simply views a
document, statelessness works fine. However, many dynamic Web applications
need information to pass from page to page. For example, you may want to
save a user’s name and then display the name on another page.
The next few sections discuss methods of passing information from page
to page.
|