HTML and CSS Reference
In-Depth Information
16
CATCHING
INTERACTIVE DATA
ONE OF THE most powerful and practical
aspects of working with Web programming is the
ability to store and retrieve data. HTML5 has some
capacity for such data storage and retrieval;
however, as Chapter 15 showed, any data that is
stored is going to be related to an individual's
browser. As you saw in Chapter 15, for the
time-being, all the browsers aren't exactly playing
nicely together in the sandbox when it comes to
data storage. Plus, the data are stored on the user's
computer, and while that's useful for some things,
such as recognizing a user's interests when
returning to a Web site, every user has some kind
of local storage. How do you store data (like a blog
comment) so that anyone with a browser can
access it?
comments and those made by others? One way you
could do it would be to rewrite your Web site for
every entry and comment. But that would be so
awkward that not much blogging would take place.
Blogs are set up using dif erent server-side lan-
guages, like PHP. h ord Daniel Hedengren's
Smashing WordPress: Beyond the Blog (Wiley)
explains how to optimize using WordPress's blog
sot ware. Much of the discussion is how to use PHP
to tweak your blog. However, besides working with
blogs, PHP can store and retrieve database data
from servers for anything from an online store to
members of a football team. Unlike local storage,
when data are stored using PHP, they can be
retrieved using PHP by anyone anywhere. (h ose
people don't have to come by your house and use
your browser on your computer to retrieve data
you've stored using HTML5 — and thank your
lucky stars for that.) Best of all, if you want to make
a change, all you have to do is to type in the
information, and it's sent to a database where the
changes are rel ected in the Web page. In this
chapter, I introduce you to one server-side language,
PHP. h e focus is on getting started and doing some
things with HTML5 that you can't do without PHP.
To give you a sense of what this chapter introduces,
consider something simple you can do on the Web:
maintain and comment on a blog. Suppose you
have a blog that discusses HTML5. Once or twice a
week, you sit down and write a blog entry about
HTML5. Now suppose you attract a big audience of
blog readers, and these readers comment on your
entries. How do you store and retrieve your
 
Search WWH ::




Custom Search