I needed a way to programmatically build forms with php so that I can easily print them in any template, so that when I change template I don’t have to copy paste and fix forms all over again.

So to solve this I needed some php code to automatically build forms.

For me there are 2 options:

1) Download codeigniter and get their form helper and use that

The form helper are a bunch of functions to help you build forms. You can include them into your project easily. Get the code and import it. You can see what you can do here: http://ellislab.com/codeigniter/user-guide/helpers/form_helper.html

Very well documented and easy to use. no build in validation though.

2) Use php-form-builder-class

http://code.google.com/p/php-form-builder-class/ This one is much better, but very badly documented. It has build in validation, and it can create many more types than codeigniter form helper (even cheditor google recaptcha and many HTML5 elements).

It’s object oriented and it fit perfectly into my project. You can Build your view and customize how you display your input boxes. It uses bootstrap juqeryui and html5 validation if your browser supports it.

You might have to take a look on the code though if you want to learn everything that the class can do for you. I managed to get understand the code, but for a beginner in php it might be difficult, but it’s overally good.

So that’s it,

Thanks for visiting.