Apostolos Dountsis

Web Development & Desktop Application Solutions
  • rss
  • Home
  • Projects
    • Easy Peasy Image Gallery
    • Social Bookmarks
      • Social Bookmarks Release Notes
      • Social Bookmarks Supported Sites
    • Move Comments
  • Downloads
  • Freelance Services
  • Photo Gallery
    • U2 – Vertigo Tour (Rome, Italy)
    • Brighton
    • Amsterdam
    • Athens 2004
    • Holiday Snapshots
  • Portfolio
  • About
  • Contact

Developing HTML Forms in PHP using QuickForm

The power of PHP rests on its simplicity and speed. One of the common uses of dynamic pages is the processing of HTML forms. PHP does not offer any functions for the development of web forms so managing one in PHP tends to be nothing more than a sequence of print statements. The PEAR library contains the HTML_QUICKFORM package that provides all the necessary classes and methods to display and manage HTML forms.

QuickForm Package

The HTML_QUICKFORM package (I will be referring to it as QuickForm) provides a set of classes creating, validating, processing HTML forms. Instead of printing form elements one-by-one, we can use its methods to define a form structure that handles the form. QuickForm automatically preserves default values for our elements across form submission, displays error messages, allows custom server-side validation and filtering that can be applied to individual fields and/or the complete form and generates JavaScript code for client-side validation. Furthermore, it simplifies file uploads.

The only reason why someone may feel reluctant in using QuickForm is due to the lack of proper documentation. However, this should not hold you back as this series of articles intends to cover the majority of the package. Among others, we will be concentrating on:

  • Displaying a form
  • Processing the from input
  • Field validation
  • File Uploading
  • Using SMARTY for rendering the form

The goal of the articles is to demonstrate how we can make use of QuickForm and SMARTY to develop a web application.

Requisites

QuickForm not part of the standard PEAR installation. Therefore, we need to download it and place it in the HTML directory of PEAR. Please note that the HTML_COMMON package needs to be present as well.

If the following line does not return an error then you have QuickForm present on your system.
require('HTML/QuickForm.php');

In the case that you are working on a shared host environment and you do not have access to the PEAR directory and therefore you cannot install HTML_QUICKFORM then you can always download PEAR, HTML_COMMON and HTML_QUICKFORM to your webspace. Instructions on the manual installation of PEAR can be found on the PEAR web site.

Bookmark This Page

Add to Buzz Add to Del.icio.us Add to DotNetKicks Add to Facebook Add to Google Bookmarks Add to Mister Wong Add to Tip'd Add to Twitter Add to Yahoo My Web
Hide Sites

Pages: 1 2 3 4

Categories
PHP
Tags
PEAR, PHP
Comments rss
Comments rss
Trackback
Trackback

« A Solid Block of Code is Like a Well Proven Theorem EPIG Add-Ons »

2 Responses to “Developing HTML Forms in PHP using QuickForm”

  1. Trent says:
    June 27, 2006 at 12:35

    Very concise. Thanks, I’ll be using this info!

  2. PEAR QuickForm - Formular mit Validierung (PHP) | SteviesWebsite Blog says:
    May 21, 2009 at 14:40

    [...] Developing HTML Forms in PHP using QuickForm (dountsis.com, en) [...]

Leave a Reply

Click here to cancel reply.

About Dountsis.com

Dountsis.com is the site of the web developer, technology enthusiast, and gadgets addict, Apostolos Dountsis. The articles on this site focus on web development, software and freelance.

Topics

  • EPIG (2)
  • Firefox (6)
  • Funny (1)
  • Programming (3)
  • Site Updates (7)
  • Tutorials (4)
    • .NET (1)
    • PHP (3)
  • Windows (5)
  • WordPress (25)

PayPal Button

If you feel that the open-source projects that I develop and deliver through the site are worth a penny then you could press the button below to send it to me.

Keywords

.NET adblock Bad Sectors C# chkdsk Del.icio.us Eclipse Extension Firefox Hard Disk Microsoft Move Comments PEAR PHP Social Bookmarks Spam User Control Windows Windows XP WinForm WordPress

What I'm Doing...

  • Nite nite 1 week ago
  • RT @JulieMaggot: Τζουλια ΕΕΕΛΑΑΑΑΑ!, Θα κανουμε Σαμπανιαααααααααααα!! #julia_porn 1 week ago
  • My back! Ouch ouch 3 weeks ago
  • More updates...

Recent Articles

  • Social Bookmarks 4.1.2 Point Release
  • How to use User Controls to create MDI WinForm Applications
  • Social Bookmarks Sites Cleanup
  • Social Bookmarks 4.1.1
  • WordPress Plugins Activation Order
  • WordPress Plugin Development

Spam Blocked

65,105 spam comments
blocked by
Akismet
rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox