Welcome to Php Form Builder

Php Form Builder is a simple but powerful class in witch you can create complex forms easily.

Php Form Builder is ready to use with Bootstrap and Material Design themes, but can be easily adapted for other frameworks or as standalone.
All you need is to match Form options with your framework.

Documentation is well-adapted for all types of users : PHP beginners as well as confirmed programmers.

Please see Where to start ? section to find the best place to start depending on your skills.

Build Bootstrap Forms

Php Form Builder's default settings are Bootstrap ready.

Build Material Forms

Material forms are part of Php Form Builder's package.
Switch from Bootstrap to Material with a single line of code.

Build Standalone Forms

Php Form Builder can adapt generated html to any framework,
or generate simple standard HTML5 elements.

50+ Form Templates

Each template is given with code you can easily copy / paste.
Code includes Server side Validation and Email sending

Email Sending

Built-in function to send posted values easily.
Support for attachments and Custom E-Mail templates

Easy Contact Form

Shortcut function to build contact form in 2 minutes

Powerful jQuery plugins integration

Don't waste your time to include css & js files, generate js code, ...
Php Form Builder will add any jQuery plugin in a very easy way and do all this job for you.

15+ awesome jQuery plugins included

Best jQuery Form plugin included in package and ready to use to enhance your forms with file uploader, custom radio, checkboxes, select, pickers (date, time, color), captcha, ...

Maximum Security

Automatic XSS and CSRF protection - maximum level security

Server-side validation

Validate any field with any condition.
Your page will automatically scroll to user error if fields are not filled correctly.

Conditional logic

Show / Hide fields depending on user's choices
One easy function for all logic. Conditional fields can be nested.

Special forms

Ajax forms, Step forms, Modal forms, Popover forms, Accordion forms : Simple and easy integration with templates and full documentation.

- Fast & Efficient Professional Support -

We take care of each customer
and do our best to give efficient help.

Where to start ?

Depending on your php knowledge :

PHP Beginners

Beginners Guide
Tutorial for PHP beginners including full detailed explanations

PHP programmers

Quick start Guide
Quick and easy start with minimum required.

About functions and how to

Class documentation
Full class documentation.
How to ... ?
F.A.Q. with code examples to help with layout, icons, plugins, dependant fields and so on.
Functions reference
All functions & arguments.

Build a fully-working contact form in 2 minutes without any knowledge

Contact form in 2 minutes
If you don't want to learn, just want a working contact form.


  • Form generation with complex layout capabilities (horizontal, vertical, inline)
    Php Form Builder generates clean HTML5 markup, with separates functions to render form, generate CSS and JS code, so you can render them separately (generaly in <head> or just before </body>).

  • Bootstrap Forms, Material Design Forms, Compatible with any framework or can be used as Standalone.

  • Accepts any HTML5 form elements, including fieldsets, multiple selects, optgroups, button groups, ...

  • Allows to customize HTML with wrappers, IDs, classes and attributes, Javascript events, custom code almost anywhere.

  • Server-side validation can be done on any destination page ; errors are stored in session

  • Send your emails with simple or advanced function - detects and replaces posted values in default or custom html/css template. Uses PHPMailer and Emogrifier to inline css.

  • XSS / CSRF Protection

  • Database class included to easily prefill fields with values from your database, Insert/Update/Delete elements using posted values.

  • Numerous jQuery plugins included :

    Date & Time pickers

  • Memorization / recall of any custom configuration for each plugin

  • You can easily add any other external plugin (see plugins section).
    When you activate a plugin, the needed css and js files will be automaticaly added to your page.

  • Sublime-text 3 plugin available on Github

  • Bracket plugin available on Github


Bootstrap 3

Default'theme is Bootstrap 3.

All options are ready to use, and will generate all Bootstrap's markup and classes.

Material Design

Material Design forms are based on Bootstrap 3.

Markup and options are exactly the same for both.

To switch from Bootstrap to Material Design, just add bootstrap-material-design plugin


Version 2.1 (10/2016)

    New Features :
        - add Recaptcha plugin
        - update Fileupload plugin to latest version
        - add new template default-db-values-form.php
        - add new template fileupload-test-form.php
        - add default values [from database|from variables] in 'how-to' documentation
        - add a 4th optional argument to group 4 inputs in same wrapper
    Bug Fix :
        - missing required sign with radio and no classname

Version 2.0.3 (08/2016)

    Improvements :
        - Rewritten Dynamic Fields Template javascript to match any field
        - update sendAdvancedMail() function to automatically convert posted arrays to comma separated lists in email

Version 2.0.2 (08/2016)

    Bug Fix :
        - fix dependant select with checkboxes
        - fix custom attributes with checkbox groups

Version 2.0.1 (08/2016)

    Improvements :
        - Add Dynamic Fields Templates
    Bug Fix :
        - fix php7 warning (upload button not shown) using addFileUpload() function

version 2.0 (Major release - 07/2016)


All features are backward-compatible, except addCheckbox() function : 3rd argument ($name) has been removed.

  • Previous versions : $form->addCheckbox($group_name, $label, $name, $value, $attr = '');
  • New version 2.0 : $form->addCheckbox($group_name, $label, $value, $attr = '');

(see examples or main class doc for more informations).

    New Features :
        - add Material Design plugin
        - add Material Design templates
        - add Modal plugin
        - add Popover plugin
        - add Pickadate plugin + Pickadate Material
        - add XSS protection
        - add CSRF protection
                (documentation : http://phpformbuilder.creation-site.org/documentation/class-doc/index.html#security)
        - add 2 functions for dependant fields :
                -   startDependantFields($parent_field, $show_values) ;
                -   endDependantFields();
        - add Autocomplete plugin
        - add support for input grouped with button (ie : search input + btn)
        - automatic scroll to first field with error
        - add third argument to render function to allow returning form code instead of echo
    Improvements :
        - restructure package
        - rewrite all documentation
        - add php beginner's guide
        - rewrite & optimize several Form functions
        - better error fields rendering for grouped fields
        - zero value will not be anymore considered as empty
        - checkboxes are automatically converted to an array of indexed values.
        - add new argument to render, printJsCode & printIncludes functions to return code instead of echo.
        - beautify output if debug enabled
    Updates :
        - update Bootstrap Select plugin to latest version (v1.10.0)
    Bug Fix :
        - fix validation custom error message with 'between' function
        - fix validation errors with dates + hasSymbol function
        - fix wrong comma added in some cases with select option attr.

Version 1.3.1 (10/2015)

    Bug Fix :
    - fix reply_to issue in sendAdvancedMail function

Version 1.3 (05/2015)

    Improvement :
        - improve register / clear system
    New Features :
        - add Country select plugin
        - add Bootstrap select plugin
        - add Passfield plugin
        - add Icheck plugin

Version 1.2.7 (03/2015)

    Bug Fix :
        - fix word-char-count plugin used on the same page with tinyMce + word-char-count.

Version 1.2.6 (03/2015)

    Improvement :
        - register array fieldnames in session to keep values when validation fails.

Version 1.2.5 (02/2015)

    Improvement :
        - add word-char-count support with tinyMce

Version 1.2.4 (12/2014)

    New Features :
        - add support for select into input groups
    Improvements :
        - input groups documentation & examples fully detailed

Version 1.2.3 (12/2014)

    New Features :
        - add database utilities with Myql class
        - add tinyMce (Rich Text Editor) plugin with responsivefilemanager
    Improvements :
        - add debug argument to print css/js includes & js code on screen
        - support of multiple fileUploads on the same page

Version 1.2.2 (10/2014)

    New Feature :
        - add word / character count plugin
    Bug Fix :
        - Fix object context error with php < 5.4

Version 1.2.1 (10/2014)

    Updates :
        - improve email sending with attached files

Version 1.2 (10/2014)

    New Features :
        - add sendMail function
        - add sendAdvancedMail function
        - add groupInputs function
        - add btnGroupClass option

    Updates :
        - update fileUpload plugin to last version

    Bugs Fixes :
        - Fix default checkbox wrapper html
        - Fix plugin path with only fileUploads

Version 1.1 (09/2014)

        Bugs Fixes :
        - Fix Validator compatibility with 32/64 bit systems
        - Fix object context error with php < 5.4

Version 1.0 (09/2014)

        PSR2 Standard support
        Check for security vulnerabilities
        Add documentation

Sources & Credits

Thanks so much to :