Apostolos Dountsis

Web Development & Desktop Application Solutions
  • rss
  • Home
  • Projects
    • Easy Peasy Image Gallery
    • Social Bookmarks Plugin for WordPress
      • Social Bookmarks Release Notes
    • Move Comments
  • Downloads
  • Freelance Services
  • Photo Gallery
    • U2 - Vertigo Tour (Rome, Italy)
    • Brighton
    • Amsterdam
    • Athens 2004
  • 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 BlinkBits Add to BlinkList Add to Bloglines Add to Blogmarks Add to Blogmemes Add to Blue Dot Add to Co.mments Add to Del.icio.us Add to De.lirio.us Add to Diigo Add to digg Add to DZone Add to Facebook Add to Fark Add to Feed Me Links Add to Fleck Add to FriendSite
Add to FURL Add to Google Bookmarks Add to Kaboodle Add to Ma.gnolia Add to Mister Wong Add to Netscape Add to Netvouz Add to Newsvine Add to PlugIM Add to PopCurrent Add to reddit Add to Slashdot Add to Stumble Upon Add to Shoutwire Add to SphereIt Add to Taggly 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 »

One response

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

TrentNo Gravatar | June 27, 2006

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

Leave a comment

You can use these tags : <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


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

  • Firefox (6)
  • Funny (1)
  • PHP (7)
  • Programming (3)
  • Site Updates (7)
  • Windows (5)
  • WordPress (17)

RSS Feeds

Subscribe to the Articles RSS feed Subscribe to the Comments RSS feed

Keywords

adblock Bad Sectors chkdsk Del.icio.us Extension Firefox Hard Disk Microsoft PEAR PHP Spam Windows Windows XP WordPress

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.

Recent Articles

  • Spam Comments
  • Del.icio.us Firefox 3 Extension
  • Site Revamp & WordPress 2.5
  • Social Bookmarks 4 Point Release
  • Firefox 3 Beta 4
  • Setup a Development Environment for Your WordPress Site

Spam Blocked

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

© 2006 - 2008 Apostolos Dountsis - All Rights Reserved