Help, Troubleshooting & Common issues

For any question or request

Please

If you feel lost or have any trouble, please contact me before dropping any rating

  • I can build you a form for free, or for a small fee if your form is really complex
  • I can propose a refund if PHP Form Builder doesn't match what you intended

Installation error

If you see the message "An error occured during the registration process.", or any PHP error, or white page:

You just have to enable PHP CURL extension.

Restart your php server, then the installer will work.

White page / Error 500

If your page is absolutely white or returns "HTTP ERROR 500" it means you have a php error.

To display error message, you have to enable php display errors.

  1. Add the following code just after use statements :
    <?php
    use phpformbuilder\Form;
    use phpformbuilder\Validator\Validator;
    
    // add the line below to your code :
    ini_set('display_errors', 1);
  2. Refresh your page, then you'll see what error is thrown, and probably find solution in other parts of this document.
    Once you solved your problem, remove the ini_set() line if you don't want errors to be displayed anymore.

Warning: include_once([...]): failed to open stream: No such file or directory

PHP Form Builder requires a single file, which is called using php include_once() function :

<?php
include_once rtrim($_SERVER['DOCUMENT_ROOT'], DIRECTORY_SEPARATOR) . '/phpformbuilder/Form.php';

If the path to file inside parenthesis is wrong, file is not found.

You've got to find the right path leading to your phpformbuilder directory.

To solve this, Open ../phpformbuilder/server.php in your browser and follow the instructions.

OR Try one of the followings, depending on your situation :

  1. If phpformbuilder directory is not at the root of your project, add beginning directory(ies) to your paths :
    <?php
    
    // replace "your-dir" with yours in the following line
    include_once rtrim($_SERVER['DOCUMENT_ROOT'], DIRECTORY_SEPARATOR) . '/your-dir/phpformbuilder/Form.php';
  2. Use a relative path, leading from the original file (your form) to phpformbuilder dir. You can for example try one of the followings :
    <?php
    
    // with a structure like :
    // contact-form.php
    // phpformbuilder/Form.php
    include_once 'phpformbuilder/Form.php';
    
    // with a structure like :
    // subfolder/contact-form.php
    // phpformbuilder/Form.php
    include_once 'assets/phpformbuilder/Form.php';

Fatal error: Class 'phpformbuilder\Form' not found

See Warning: include_once([...]) (same error, same solution)

Fatal error: Call to undefined function phpformbuilder\mb_strtolower()

PHP Form Builder uses the PHP mb_string extension to send emails with the correct encoding.

PHP mb_string extension allows to work with multi-bytes encoding (UTF-8, ...).

PHP mb_string extension is not a default PHP extension, but is enabled on most servers.

If it's not enabled on yours, you've got 2 solutions:

  1. (Best solution) Install/Enable PHP mb_string.
    Many explanations are available on the web to know how to proceed, and it depends on your server and system.
    1. Open phpformbuilder/Form.php and replace all occurences of mb_strtolower with strtolower.
    2. If your PHP Form Builder version is <= 3.5.2, replace
      $charset = mb_detect_encoding($mergedHtml);
      with:
      charset = 'iso-8859-1';
      if (function_exists('mb_detect_encoding')) {
          $charset = mb_detect_encoding($mergedHtml);
      }
      You'll find your version number in comments at the beginning of phpformbuilder/Form.php
    3. Warning: you may experiment encoding issues with multi-bytes encoded characters (accents, special characters) when sending emails.

Plugins don't work

  1. Open your browser's console (instructions here)

    You have to solve all errors you see in console. Errors probably come from your page content, not from phpformbuilder itself.

    Be sure you include first jQuery, THEN Bootstrap js, THEN phpformbuilder plugins code :

        <!-- jQuery -->
        <script src="//code.jquery.com/jquery.js"></script>
        <!-- Bootstrap JavaScript -->
        <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
        <?php
            $form->printIncludes('js');
            $form->printJsCode();
        ?>

     

  2. PHP Form Builder is optimized for fast loading.

    This means that all the required plugins files (CSS & Javascript) are automatically minified & concacenated.

    When you make changes to the form these files are automatically regenerated.

    The minified/concatendated files are located in phpformbuilder/plugins/min/[css|js]

    You can always safely remove the css & js files located in these 2 folders.
    They'll be regenerated and refreshed, this can in some cases solve cache issues.

    When you're in development, you can call the unminified unconcatenated files this way:

        // This will load the unminified unconcatenated files
        // printIncludes($type, $debug, $display, $combine_and_compress)
    
        $form->printIncludes('css', false, true, false);
        $form->printIncludes('js', false, true, false);
  3. In a few cases, your server may not be correctly configured. Consequence is that the plugins URLs are wrong.

    Solution is to set the URL to plugins directory manually:

    // Set URL to match your plugins directory
    $form->setPluginsUrl('http://phpformbuilder/plugins/');

I do not receive the emails sent

  1. Check that the sender_email address is from your domain ([email protected]).
    When you send emails you must always use an email address from your domain as the sender.
    Otherwise you will not pass the spam filters, which will assume that you have usurped an identity.

    You can add a reply_to_email option to set whom the reply will be sent.
  2. Edit phpformbuilder/mailer/email-sending-test.php:
    Replace the sender email address L.16 with an email address from your domain.
    Open the file in your browser and fill-in the form to send an email.
    If you still don't receive the message, contact your hosting provider and ask him to setup php to send email with the function mail().

CSS issues

Included templates use a custom version of Bootstrap's css. You'll find it in phpformbuilder/templates/assets/css/bootstrap.min.css.

Set the correct path from your form to this css :

    <!-- Bootstrap CSS - Change path with your own -->
    <link href="assets/assets/css/bootstrap.min.css" rel="stylesheet">

... Or replace with Bootstrap CDN :

    <!-- Bootstrap CSS CDN -->
    <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">

Can't Submit form (using jQuery validation plugin)

jQuery validation plugin is complex and can have unexpected behaviors if it encounters configuration issues or malformed html.

To solve this :

  1. Don't use any input, button or other form element named "submit". It's not compatible with jQuery validation (reserved name).
  2. Validate your code W3C validator
  3. Open your browser's console (F12) and look for errors.
  4. Open phpformbuilder/plugins-config/formvalidation.xml and use console.log (un-comment) to find out what's going on