Php Form Builder - Contact form in 2 minutes

You just want a fully working contact form, have no more time to spend

That's the right place. Let's start.

  1. You need a php server with php 5.3 or newer running.

    For help, go to Install and run a local PHP server

  2. Add phpformbuilder folder at the root of your project.

    For help, go to Include required files on your page to build form

  3. Configure your plugins path.

    For help, go to Configure your plugins path

  4. Copy / paste the following php blocks into your page at the indicated locations :

    <!-- paste following code at the very beginning of your file -->
    use phpformbuilder\FormExtended;
    include_once rtrim($_SERVER['DOCUMENT_ROOT'], DIRECTORY_SEPARATOR) . '/phpformbuilder/Form.php';
    include_once rtrim($_SERVER['DOCUMENT_ROOT'], DIRECTORY_SEPARATOR) . '/phpformbuilder/FormExtended.php';
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
        if (FormExtended::validateContactForm('extended-contact-form') === true) {
            $sent_message = FormExtended::sendStandardEmail('[email protected]', 'extended-contact-form');
    $form = new FormExtended('extended-contact-form', 'horizontal', 'novalidate');
    <!-- paste following code just after </head> -->
    <?php $form->printIncludes('css'); ?>
    <!-- paste following code between <body></body> where your form will be displayed -->
    if (isset($sent_message)) {
        echo $sent_message;
    <!-- paste following code just before </body> -->
  5. Replace [email protected] with the email you want the form to be sent

Your form is ready, email will be sent when form is posted and validated.

If your browser throws an error 500, click button below to solve this.

Your browser has thrown this error because php can't find FormExtended.php.

rtrim($_SERVER['DOCUMENT_ROOT'], DIRECTORY_SEPARATOR) should lead to the root of your project.
If works fine if your server is well configured, but it seems that's not the case.

To solve this, try to replace include_once rtrim($_SERVER['DOCUMENT_ROOT'], DIRECTORY_SEPARATOR) . '/phpformbuilder/FormExtended.php'; with one of the following :

  • include_once $_SERVER['DOCUMENT_ROOT'] . '/phpformbuilder/FormExtended.php';
  • include_once $_SERVER['DOCUMENT_ROOT'] . 'phpformbuilder/FormExtended.php';
  • include_once 'phpformbuilder/FormExtended.php';

You've got to find the right path to FormExtended.php, it can be absolute or relative path.