Notice: I no longer maintain this site regularly. While some content is still relevant, most of it will be migrated to my company site soon. To see what I'm up to go to

Catch-All PHP Form Processor

Current Version: 2.0.3

10 comments   1347 downloads

Added on November 2nd by Erik Reagan

Catch-All PHP Form Processor

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 (with an additional file for configuration) that has a number of options. The goal of this script is to provide a small footprint 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:


  • A PHP file inspects form data and runs simple validation on empty fields and email addresses
  • You have the option of sending the user to a Review page
  • Upon review the user can print and/or submit the results once all fields are
  • 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 (eg: IP address)

Form Field Compatibility

This script successfully processes the following field types:

  • text
  • radio
  • checkbox
  • select & options(single and multiple)
  • hidden
  • textarea
  • image


  • This script requires PHP 4.0.7 or newer

Be sure to read the docs to understand how to successfully setup multiple checkboxes within a single “name” and multiple select options within a single “name”.



I want to test your Catch-All PHP Form Processor script please.

Abraham Mbongoo Evina on Nov 10th, 2009 at 11:53 am


When updating my site I didn’t account for my download and source code links. You can now find the zip and GitHub repository on the sidebar of the project page. Let me know if you have any questions!

Erik Reagan on Nov 10th, 2009 at 12:41 pm

Hi Erik!

I believe I’ve found a bug. Line 85 of settings.php reads:


and it should read:


‘cos that’s what’s in the processor.



Stuart on Mar 3rd, 2010 at 8:29 pm

Thanks Stuart. You are indeed correct. The file has been updated accordingly. Thanks for letting me know!

Erik Reagan on Mar 3rd, 2010 at 9:52 pm

My pleasure. I’ve been using this since you first published it, and am very grateful for it. It fits into our Drupal site like a dream.

I have another one. My plain-text notification includes the lines:
What’s that all about?

Here’s a suggestion for you. I’ve elected to have the timestamp in the e-mail. Now the time given is the time on the server, which is CST. However, the form users are in the UK which is 6 hours ahead of CST, so when they submit the form the timestamp says 10:00 but the form was submitted at 16:00.. Would it be possible to add an offset value to the settings file, something like timezone_correction=6?



Stuart on Mar 3rd, 2010 at 10:16 pm

Thanks again Stuart. I fixed the ‘Senditalready’ bug. That was basically a trigger to send the email rather than display the results preview page. I didn’t change the version number so just re-download 2.0.2 if you already downloaded it after the other bug fix.

As for the time, I’ll take a look and make a change sometime soon. Thank you for pointing it out!

Erik Reagan on Mar 3rd, 2010 at 10:38 pm

I believe I’ve found another bug!

Line 61 of the processor reads:

  if ( $fromEmailIsInForm )

but it should read:

  if ( $from_email_in_form )

to make it agree with settings.php and follow the general structure of the other variables.

Stuart on Mar 4th, 2010 at 10:04 pm

I forgot to mention that I’ve also added a “Go Back” button to the review page. Even if there are no errors, a user may want to change what’s being submitted after review. Accordingly, I’ve changed line 215 of the processor to:

  $block .= “\t<input type=\“button\” name=\“back\” value=\“Go Back\” id=\“back\”><input type=\“button\” name=\“print\” value=\“Print Results\” id=\“print\” onclick=\“window.print();\” ><input type=\“submit\” name=\“submit\” value=\“Send Results\” id=\“submit\” /></p>\n </form>\n</div>\n”;

Stuart on Mar 4th, 2010 at 10:12 pm

Hello Erik,
Thank you for the PHP script!. But how do you go straight to the final destination link, and bypassing the thank you screen. Also, is it possible to adjust the formatting on the plain text email. As I need the TextField and inputted information on the same line.
Sorry to ask, but I’ve only just started using PHP.

Martin on Jan 24th, 2011 at 11:31 am


I don’t believe there is a way to bypass the thank you screen right now. In order to alter the plain text email you will need to look around lines 234 - 244 of process-form.php to make any desired adjustments.

I will soon be removing this script from my site with the intention of replacing it with an object oriented version in the works. It will be distributed through my company, Focus Lab, LLC and will remain free. You can take a peek at it on my GitHub repository but it’s not production ready. I haven’t touched it in months.

Erik Reagan on Jan 31st, 2011 at 11:06 am

Your Words of Wisdom

Remember me       Notify me of follow-up comments