HTML is a very simple mark-up language that offers its users a great deal of flexibility. While this might make it very easy to learn and write in, it makes the job of web browsers such as Internet Explorer and Mozilla much harder - they need to be able to cope with thousands of exceptions.
The problem with HTML was that it became used to store style rather than just information - for example, designers would use HTML to specify the font of a piece of text, as opposed to what that kind of 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 realised that there are simply too many HTML-based web sites in existence to be able to just drop HTML, so the standard "XHTML" was born - a modification of HTML that makes it XML-compliant.
A lot of the code you see in this book is XHTML-compliant (and we're working on the rest of it!), and I recommend you keep to this in your own work. You may notice that all HTML attributes are surrounded by quotes, and all HTML tags used in this book are closed either by using </tag> or using <tag /> - these are two of the rules enforced in XHTML. While teaching HTML and/or XHTML is outside the remit of this book, we are at least going to look at creating HTML forms - the primary means of sending data to PHP.
Creating and handling forms is one of the key skills of a PHP developer, so this section is particularly important - you may want to read some parts more than once to make sure it all sinks in, as you will likely need to know much of this on a regular basis.
Want to learn PHP 7?
Hacking with PHP has been fully updated for PHP 7, and is now available as a downloadable PDF. Get over 1200 pages of hands-on PHP learning today!
If this was helpful, please take a moment to tell others about Hacking with PHP by tweeting about it!
Next chapter: What does it mean to be dynamic? >>
Previous chapter: HTML Forms
Home: Table of Contents
Copyright ©2015 Paul Hudson. Follow me: @twostraws.