Catch-all PHP Form Processor

Introduction

Through my work in web development I’ve noticed the high number of times I need to write out a contact or registration form for a client. Each time I get the form fields together and then decide how I want to process the form. This usually entails a client-side validation of certain fields (required fields, email validation, etc) and then a back-end check of those fields before processing them. This process can get pretty repetitive if you do a high volume of projects or sites needing this function. I was looking for a way to process any form I create with the same script each time and thus produced this php script. It’s a lightweight, single file form processor that has a number of options. The goal of this script is to provide asingle file resource available to use over and over. For certain forms you may want to implement your own client-side validation of fields before sending them to the form processor. Let’s explore the features:

Features

  • A single php file inspects form data and displays it to the user for review. Upon review the user can print and/or submit the results once all fields are valid (as discussed below)
  • Can submit results to 1 or more email accounts
  • Can send a blind carbon copy (bcc) as well
  • Email results can be plain text or HTML formatted
  • Script can be used in a standalone environment or as a part of your existing site template
  • You can define which fields are required
  • You can define which fields (if any) should not be displayed back to the user when they check the results before submission
  • Checks for validity of email address (to confirm it is, in fact, an email address)

Read the rest of this entry »

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.