Processing Multiple Forms on One Page with PHP

I know that the way most people treat multiple forms on one page is to have each form post to another PHP file where the form is validated, its information is entered into a database or an email is sent off. So you usually have something like this:

blah blah blah
blah blah blah

That work great, but why would you create all those extra files when you can just have the form post to the same file and create multiple functions to process your multiple forms.

The solution is very simple and super efficient.
First, lets create some forms.

Now lets put some PHP code before the <head> tag to have different processes for each form.


Now all you need to do is create your processes within those two “if” statements and each form will be dealt with accordingly when it it filled and submitted.

Share this:

Email
Facebook
Twitter
Pinterest
Pocket

Premium Themes for WordPress

Looking for an easy-to-use Premium Theme for WordPress? Check out Themes by bavotasan.com and have your site up and running in no time.

Use this WordPress website builder to build powerful websites in no time for your or your clients.

WordPress Hosting

WP Engine – designed from the ground-up to support and enhance the workflow of web designers.

Bluehost – providing quality web hosting solutions since 1996.

About the author

Picture of Luke Perrie

Luke Perrie