Chapter 9. HTML Forms

PHP was originally designed for use on the Internet, and although you can now use it for command-line applications and GUIs, its main purpose remains working on the Web. When it comes to the Web, HTML has ruled unchallenged for some years as the de facto standard for displaying information, even more so now that WAP usage has evaporated. This means that if you want to write a frontend for your PHP web applications, you need to understand HTML.

HTML is a very simple markup language that offers its users a great deal of flexibility. While this might make it easy to learn and write in, it makes the job of web browsers such as Internet Explorer and Mozilla much harder, because they need to be able to cope with thousands of exceptions.

The problem with HTML is that it became used to express style instead of just information. For example, designers would use HTML to specify the font of a piece of text, as opposed to what that the text was. With content and style so irretrievably mixed inside HTML, computers were not able to extract information about a document simply by reading through the HTML tags used.

A movement was started to redefine how web pages are designed so that HTML would contain only content information, with a new language, CSS (cascading style sheets) storing the style information. There were also some recommending that XML was the way forward for data, and that HTML could be eliminated altogether. While the XML argument made sense, many realized that ...

Get PHP in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.