Skip to Main Content
PHP in a Nutshell
book

PHP in a Nutshell

by Paul Hudson
October 2005
Intermediate to advanced content levelIntermediate to advanced
372 pages
11h 35m
English
O'Reilly Media, Inc.
Content preview from PHP in a Nutshell

Form Design

As mentioned already, forms are the primary way for users to send data to your scripts, so it's essential that you get them right. Above and beyond the coding aspect of forms, there are a number of basic usability guidelines you should follow in your design :

  • Use stylesheets or tables to lay your elements out neatly. This makes the form easier to read, and it is also easier to report individual errors on fields.

  • If there is an error within a field, put a notice next to it and a message at the top of the page; otherwise, people may not realize there's a problem. You should also consider changing the color of the problem field to make it obvious which one is bad.

  • Mark required fields either with bold text or, more commonly, an asterisk *.

  • If your database has a field length limit, put a size limit on a text box to stop people from entering too much text and later finding out their data has been trimmed by your database.

  • Don't make your forms too long—they confuse people and make them feel threatened.

  • If you split your form across pages, let your visitors know how far they are in the process of form submission, e.g., "Page 2 of 5." This lets people know where they stand at all times, without leaving them wondering, "Will this next button take money out of my account, or are there more pages to come?"

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

PHP Cookbook

PHP Cookbook

Eric A. Mann
Programming PHP

Programming PHP

Rasmus Lerdorf, Kevin Tatroe
Learning PHP

Learning PHP

David Sklar

Publisher Resources

ISBN: 0596100671Errata Page