An Ajax error occurred.

Home Forums Quform PHP An Ajax error occurred.

This topic is: resolved
Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #26733
    pankicid
    Participant

    Hi, I think I’m doing everything like on the tutorial but I sill become this error msg. I have attached my HTML and process.php file.
    Thanks in advance.

    #26735
    pankicid
    Participant

    Hoh, I cant send .php and .html files. Can you provide me an email address so I can send it.

    #26736
    pankicid
    Participant

    <div class=”container”>

    <div class=”quform-outer quform-theme-light-light”>
    <form class=”quform” action=”quform/process.php” method=”post” enctype=”multipart/form-data” onclick=””>

    <div class=”quform-inner”>
    <h3 class=”quform-title”>Kontakt Form</h3>
    <p class=”quform-description”>Die mit einem * gekennzeichneten Felder sind Pflichtfelder.</p>

    <div class=”quform-elements”>

    <!– Begin 2 column Group –>
    <div class=”quform-group-wrap quform-group-style-plain quform-group-alignment-left”>
    <div class=”quform-group-elements”>

    <div class=”quform-group-row quform-group-row-2cols”>

    <!– Begin Text input element –>
    <p>Persönliche Daten:</p>
    <div class=”quform-element quform-element-text”>
    <div class=”quform-spacer”>
    <label for=”name”>Vorname <span class=”quform-required”>*</span></label>
    <div class=”quform-input”>
    <input id=”name” type=”text” name=”name” />
    </div>
    </div>
    </div>
    <!– End Text input element –>

    <!– Begin Text input element –>
    <div class=”quform-element quform-element-text”>
    <div class=”quform-spacer”>
    <label for=”nachname”>Nachname <span class=”quform-required”>*</span></label>
    <div class=”quform-input”>
    <input id=”nachname” type=”text” name=”nachname” />
    </div>
    </div>
    </div>
    <!– End Text input element –>

    </div>

    </div>
    </div>

    <!– End 2 column Group –>
    <!– Begin 2 column Group –>

    <div class=”quform-group-wrap quform-group-style-plain quform-group-alignment-left”>
    <div class=”quform-group-elements”>

    <div class=”quform-group-row quform-group-row-2cols”>

    <!– Begin Text input element –>
    <div class=”quform-element quform-element-text”>
    <div class=”quform-spacer”>
    <label for=”email”>E-Mail <span class=”quform-required”>*</span></label>
    <div class=”quform-input”>
    <input id=”email” type=”text” name=”email” />
    </div>
    </div>
    </div>
    <!– End Text input element –>

    <!– Begin Text input element –>
    <div class=”quform-element quform-element-text”>
    <div class=”quform-spacer”>
    <label for=”firma”>Firma</label>
    <div class=”quform-input”>
    <input id=”firma” type=”text” name=”firma” />
    </div>
    </div>
    </div>
    <!– End Text input element –>

    </div>

    </div>
    </div>
    <!– End 2 column Group –>

    <!– Begin 2 column Group –>
    <br>
    <div class=”quform-group-wrap quform-group-style-plain quform-group-alignment-left”>
    <div class=”quform-group-elements”>

    <div class=”quform-group-row quform-group-row-2cols”>

    <!– Begin Text input element –>
    <p>Anschrift / Kontakt:</p>
    <div class=”quform-element quform-element-text”>
    <div class=”quform-spacer”>
    <label for=”strasse”>Straße <span class=”quform-required”>*</span></label>
    <div class=”quform-input”>
    <input id=”strasse” type=”text” name=”strasse” />
    </div>
    </div>
    </div>
    <!– End Text input element –>

    <!– Begin Text input element –>
    <div class=”quform-element quform-element-text”>
    <div class=”quform-spacer”>
    <label for=”plz_ort”>PLZ/Ort <span class=”quform-required”>*</span></label>
    <div class=”quform-input”>
    <input id=”plz_ort” type=”text” name=”plz_ort” />
    </div>
    </div>
    </div>
    <!– End Text input element –>

    </div>

    </div>
    </div>
    <!– End 2 column Group –>
    <!– Begin 2 column Group –>
    <div class=”quform-group-wrap quform-group-style-plain quform-group-alignment-left”>
    <div class=”quform-group-elements”>

    <div class=”quform-group-row quform-group-row-2cols”>

    <!– Begin Text input element –>
    <div class=”quform-element quform-element-text”>
    <div class=”quform-spacer”>
    <label for=”telefon”>Telefon <span class=”quform-required”>*</span></label>
    <div class=”quform-input”>
    <input id=”telefon” type=”text” name=”telefon” />
    </div>
    </div>
    </div>
    <!– End Text input element –>

    <!– Begin Text input element –>
    <div class=”quform-element quform-element-text”>
    <div class=”quform-spacer”>
    <label for=”fax”>Fax</label>
    <div class=”quform-input”>
    <input id=”fax” type=”text” name=”fax” />
    </div>
    </div>
    </div>
    <!– End Text input element –>

    </div>

    </div>
    </div>
    <!– End 2 column Group –>

    <!– Begin 2 column Group –>
    <div class=”quform-group-wrap quform-group-style-plain quform-group-alignment-left”>
    <div class=”quform-group-elements”>

    <div class=”quform-group-row quform-group-row-2cols”>

    <!– Begin Text input element –>
    <br><p>Rückantwort per:</p>
    <div class=”quform-element quform-element-checkbox”>
    <div class=”quform-spacer”>
    <label><span class=”quform-required”></span></label>
    <div class=”quform-input”>
    <div class=”quform-options quform-options-inline”>
    <div class=”quform-option”>
    <label><input name=”tel_mail[]” value=”One” type=”checkbox” />Telefon</label>
    </div>
    <div class=”quform-option”>
    <label><input name=”tel_mail[]” value=”Two” type=”checkbox” />E-Mail</label>
    </div>

    </div>
    </div>
    </div>
    </div>
    <!– End Text input element –>

    <!– Begin Text input element –>

    <!– End Text input element –>

    </div>

    </div>
    </div>
    <!– End 2 column Group –>
    <!– Begin 2 column Group –>
    <div class=”quform-group-wrap quform-group-style-plain quform-group-alignment-left”>
    <div class=”quform-group-elements”>

    <div class=”quform-group-row quform-group-row-2cols”>

    <!– Begin Text input element –>
    <div class=”quform-element quform-element-date”>
    <div class=”quform-spacer”>
    <label>Datum<span class=”quform-required”>*</span></label>
    <div class=”quform-input”>
    <select name=”date[day]”>
    <option value=””>Tag</option>
    <option value=”1″>1</option>
    <option value=”2″>2</option>
    <option value=”3″>3</option>
    <option value=”4″>4</option>
    <option value=”5″>5</option>
    <option value=”6″>6</option>
    <option value=”7″>7</option>
    <option value=”8″>8</option>
    <option value=”9″>9</option>
    <option value=”10″>10</option>
    <option value=”11″>11</option>
    <option value=”12″>12</option>
    <option value=”13″>13</option>
    <option value=”14″>14</option>
    <option value=”15″>15</option>
    <option value=”16″>16</option>
    <option value=”17″>17</option>
    <option value=”18″>18</option>
    <option value=”19″>19</option>
    <option value=”20″>20</option>
    <option value=”21″>21</option>
    <option value=”22″>22</option>
    <option value=”23″>23</option>
    <option value=”24″>24</option>
    <option value=”25″>25</option>
    <option value=”26″>26</option>
    <option value=”27″>27</option>
    <option value=”28″>28</option>
    <option value=”29″>29</option>
    <option value=”30″>30</option>
    <option value=”31″>31</option>
    </select>
    <select name=”date[month]”>
    <option value=””>Monat</option>
    <option value=”1″>Januar</option>
    <option value=”2″>Februar</option>
    <option value=”3″>März</option>
    <option value=”4″>April</option>
    <option value=”5″>Mai</option>
    <option value=”6″>Juni</option>
    <option value=”7″>Juli</option>
    <option value=”8″>August</option>
    <option value=”9″>September</option>
    <option value=”10″>Oktober</option>
    <option value=”11″>November</option>
    <option value=”12″>Dezember</option>
    </select>
    <select name=”date[year]”>
    <option value=””>Jahr</option>
    <option value=”2018″>2018</option>
    <option value=”2019″>2019</option>
    <option value=”2020″>2020</option>
    <option value=”2021″>2021</option>
    <option value=”2022″>2022</option>
    </select>
    </div>
    </div>
    </div>
    <!– End Text input element –>

    <!– Begin Text input element –>
    <div class=”quform-element quform-element-time”>
    <div class=”quform-spacer”>
    <label>Uhr <span class=”quform-required”>*</span></label>
    <div class=”quform-input”>
    <select name=”time[hour]”>
    <option value=””>HH</option>
    <option value=”01″>01</option>
    <option value=”02″>02</option>
    <option value=”03″>03</option>
    <option value=”04″>04</option>
    <option value=”05″>05</option>
    <option value=”06″>06</option>
    <option value=”07″>07</option>
    <option value=”08″>08</option>
    <option value=”09″>09</option>
    <option value=”10″>10</option>
    <option value=”11″>11</option>
    <option value=”12″>12</option>
    <option value=”13″>13</option>
    <option value=”14″>14</option>
    <option value=”15″>15</option>
    <option value=”16″>16</option>
    <option value=”17″>17</option>
    <option value=”18″>18</option>
    <option value=”19″>19</option>
    <option value=”20″>20</option>
    <option value=”21″>21</option>
    <option value=”22″>22</option>
    <option value=”23″>23</option>
    </select>
    <select name=”time[minute]”>
    <option value=””>MM</option>
    <option value=”00″>00</option>
    <option value=”15″>15</option>
    <option value=”30″>30</option>
    <option value=”45″>45</option>
    </select>

    </div>
    </div>
    </div>
    <!– End Text input element –>

    </div>

    </div>
    </div>

    <!– End 2 column Group –>
    <!– Begin 2 column Group –>
    <div class=”quform-group-wrap quform-group-style-plain quform-group-alignment-left”>
    <div class=”quform-group-elements”>

    <div class=”quform-group-row quform-group-row-2cols”>

    <!– Begin Text input element –>
    <div class=”quform-element quform-element-checkbox”>
    <div class=”quform-spacer”>
    <label>Oder: </label>
    <div class=”quform-input”>
    <div class=”quform-options quform-options-inline”>
    <div class=”quform-option”>
    <label><input name=”schnell[]” value=”One” type=”checkbox” />Schnellstmöglich</label>
    </div>
    </div>
    </div>
    </div>
    </div>
    <!– End Text input element –>

    </div>
    </div>
    </div>
    <!– End 2 column Group –>

    <!– Begin Textarea element –>
    <div class=”quform-element quform-element-textarea quform-huge”>
    <div class=”quform-spacer”>
    <label for=”message”>Ihre Nachricht: <span class=”quform-required”>*</span></label>
    <div class=”quform-input”>
    <textarea id=”message” name=”message” style=”height: 130px;”></textarea>
    </div>
    </div>
    </div>
    <!– End Textarea element –>

    <!– Begin Captcha element –>
    <div class=”quform-group-row quform-group-row-cols”>
    <div class=”quform-element quform-element-recaptcha”>
    <div class=”quform-spacer”>
    <label>Sind Sie ein Mensch? <span class=”quform-required”>*</span></label>
    <div class=”quform-input”>
    <div class=”g-recaptcha” data-sitekey=””></div>
    <noscript>Bitte aktivieren Sie JavaScript, um dieses Formular zu senden.</noscript>
    </div>
    </div>
    </div>
    </div>
    <!– End Captcha element –>

    <!– Begin Submit button –>
    <div class=”quform-submit”>
    <div class=”quform-submit-inner”>
    <button type=”submit”><span>Nachricht senden</span></button>
    </div>
    <div class=”quform-loading-wrap”><span class=”quform-loading”></span></div>
    </div>
    <!– End Submit button –>
    </div>
    </div>
    </form>
    </div>

    #26737
    pankicid
    Participant

    // And the process file

    <?php

    /**
    * Enable debug mode. Quform will try to display any fatal PHP errors or exceptions at
    * your form. It’s useful to have this enabled while developing your form, but
    * you should set this to false on production sites.
    */
    define(‘QUFORM_DEBUG’, true);

    /** DO NOT CHANGE THESE 2 LINES **/
    define(‘QUFORM_ROOT’, realpath(dirname(__FILE__)));
    require_once QUFORM_ROOT . ‘/common.php’;
    /** DO NOT CHANGE THESE 2 LINES **/

    /** FORM SETTINGS **/

    /**
    * Success message, displayed when the form is successfully submitted
    */
    $config[‘successMessage’] = ‘Ihre Nachricht wurde gesendet, danke.
    .’;

    /**
    * Whether or not to send the notification email. You may wish to disable this if you are
    * saving the form data to the database for example. true or false
    */
    $config[’email’] = true;

    /**
    * Configure the recipients of the notification email message. For a single
    * recipient use the following format:
    *
    * $config[‘recipients’] = ‘me@example.com’;
    *
    * You can add multiple email addresses by adding one on each line inside an
    * array, enclosed in quotes, separated by commas. E.g.
    *
    * $config[‘recipients’] = array(
    * ‘recipient1@example.com’,
    * ‘recipient2@example.com’
    * );
    */
    $config[‘recipients’] = ‘info@example.com’;

    /**
    * Set the “From” address of the emails. You should set this to the contact
    * email address of your website. Some hosts require that the email
    * address is one that is associated with your hosting account.
    *
    * You can set this to be an email address string e.g.
    *
    * $config[‘from’] = ‘company@example.com’;
    *
    * Or you can also include a name with your email address using an array e.g.
    *
    * $config[‘from’] = array(‘company@example.com’ => ‘Company’);
    *
    * Or you can set it to use a submitted email address. This example will get the
    * submitted address in the ’email’ field. E.g.
    *
    * $config[‘from’] = ‘%email%’;
    */
    $config[‘from’] = ‘info@example.com’;

    /**
    * The subject of the notification email message. %first_name% will be replaced
    * with the form submitted value in the first_name field.
    */
    $config[‘subject’] = ‘Message from %name%’;

    /**
    * Set the “Reply-To” email address of the notification email to
    * the email address submitted in the email field.
    */
    $config[‘replyTo’] = ‘%email%’;

    /**
    * The file containing the HTML body of the notification email.
    */
    $config[’emailBody’] = ‘/emails/notification.php’;

    /**
    * Whether or not to show empty fields from the notification email. true or false
    */
    $config[‘showEmptyFields’] = false;

    /**
    * Whether or not to send an autoreply email. true or false
    */
    $config[‘autoreply’] = false;

    /**
    * Sets the autoreply recipient to the email address submitted to the email field
    *
    * If you want the email to show from their name submitted from the name field as well, you
    * can use the code:
    *
    * $config[‘autoreplyRecipient’] = array(‘%email%’ => ‘%name%’);
    */
    $config[‘autoreplyRecipient’] = ‘%email%’;

    /**
    * The subject of the autoreply email
    */
    $config[‘autoreplySubject’] = ‘Thanks for your message, %name%’;

    /**
    * Set the “From” address of the autoreply email.
    * See the comment at the $config[‘from’] setting for options.
    */
    $config[‘autoreplyFrom’] = ”;

    /**
    * The file containing the HTML body of the autoreply email
    */
    $config[‘autoreplyBody’] = ‘/emails/autoreply.php’;

    /**
    * Redirect the user when the form is successfully submitted by entering a URL here.
    * By default, users are not redirected.
    *
    * $config[‘redirect’] = ‘http://www.example.com/thanks.html&#8217;;
    */
    $config[‘redirect’] = ”;

    /**
    * Whether or not to save the form data to a database. true or false
    *
    * You can configure the database settings further down in this file. See the documentation
    * for help.
    */
    $config[‘database’] = false;

    /**
    * Whether or not to save uploaded files to the server. true or false
    */
    $config[‘saveUploads’] = false;

    /**
    * The path to save any uploaded files. This folder must be writeable by the
    * web server, you may need to set the folder permissions to 777 on Linux servers.
    */
    $config[‘uploadPath’] = QUFORM_ROOT . ‘/uploads’;

    /**
    * Set this to the URL of the above folder to be sent links to uploaded
    * files in the notification email. E.g.
    *
    * $config[‘uploadUrl’] = ‘http://www.example.com/quform/uploads&#8217;;
    */
    $config[‘uploadUrl’] = ”;

    /**
    * (Optional) Configure your SMTP settings, only ‘host’ is required. If your server
    * needs authentication, set your username and password. If these settings are left
    * blank the emails will be sent using the PHP mail() function.
    *
    * host – SMTP server (e.g. smtp.example.com)
    * port – SMTP port (e.g. 25)
    * username – SMTP username
    * password – SMTP password
    * encryption – SMTP encryption (e.g. ssl or tls)
    */
    $config[‘smtp’] = array(
    ‘host’ => ”,
    ‘port’ => 25,
    ‘username’ => ”,
    ‘password’ => ”,
    ‘encryption’ => ”
    );

    // Add the visitor IP to the email
    $config[‘extra’][‘IP address’] = Quform::getIPAddress();

    /** END FORM SETTINGS **/

    /** FORM ELEMENT CONFIGURATION **/

    /**
    * Configure the first name element
    * Filters: Trim
    * Validators: Required
    */
    $name = new Quform_Element(‘name’, ‘Name’);
    $name->addFilter(‘trim’);
    $name->addValidator(‘required’);
    $form->addElement($name);

    /**
    * Configure the Nachname element
    * Filters: Trim
    * Validators: Required
    */
    $nachname = new Quform_Element(‘nachname’, ‘Nachname’);
    $nachname->addFilter(‘trim’);
    $nachname->addValidator(‘required’);
    $form->addElement($nachname);

    /**
    * Configure the email address element
    * Filters: Trim
    * Validators: Required,
    */
    $email = new Quform_Element(’email’, ‘Email address’);
    $email->addFilter(‘trim’);
    $email->addValidators(array(‘required’, ’email’));
    $form->addElement($email);

    /**
    * Configure the Firma element
    * Filters: Trim
    */
    $firma = new Quform_Element(‘firma’, ‘Firma’);
    $firma->addFilter(‘trim’);
    $form->addElement($firma);

    /**
    * Configure the plz_ort element
    * Filters: Trim
    * Validators: Required,
    */
    $plz_ort = new Quform_Element(‘plz_ort’, ‘PLZ/Ort’);
    $plz_ort->addFilter(‘trim’);
    $plz_ort->addValidator(‘required’);
    $form->addElement($plz_ort);

    /**
    * Configure the strasse element
    * Filters: Trim
    * Validators: Required,
    */
    $strasse = new Quform_Element(‘strasse’, ‘Strasse’);
    $strasse->addFilter(‘trim’);
    $strasse->addValidator(‘required’);
    $form->addElement($strasse);
    /**
    * Configure the telefon element
    * Filters: Trim
    * Validators: Required,
    */
    $telefon = new Quform_Element(‘telefon’, ‘Telefon’);
    $telefon->addFilter(‘trim’);
    $telefon->addValidator(‘required’)
    $form->addElement($telefon);

    /**
    * Configure the fax element
    * Filters: Trim
    * Validators: NOT Required,
    */
    $fax = new Quform_Element(‘fax’, ‘Fax’);
    $fax->addFilter(‘trim’);
    $form->addElement($fax);

    /**
    * Configure the checkbox tel_mail element
    * Filters: Trim
    * Validators: NOT Required,
    */

    $tel_mail = new Quform_Element(‘tel_mail[]’);
    $form->addElement($tel_mail);

    /**
    * Configure the checkbox schnell element
    * Filters: Trim
    * Validators: NOT Required,
    */

    $schnell = new Quform_Element(‘schnell[]’);
    $form->addElement($schnell);

    /**
    * Configure the date element
    * Filters: Trim
    * Validators: NOT Required,
    */
    $date = new Quform_Element_Date(‘date’, ‘Date’);
    $form->addElement($date);

    /**
    * Configure the time element
    * Filters: Trim
    * Validators: NOT Required,
    */
    $time = new Quform_Element_Time(‘time’, ‘Time’);
    $form->addElement($time);
    /**
    * Configure the message element
    * Filters: Trim
    * Validators: Required
    */
    $message = new Quform_Element(‘message’, ‘Message’);
    $message->addFilter(‘trim’);
    $message->addValidator(‘required’);
    $form->addElement($message);

    /**
    * Configure the CAPTCHA element
    * Filters: Trim
    * Validators: Required, Identical
    */

    $recaptcha = new Quform_Element(‘g-recaptcha-response’, ‘reCAPTCHA’);
    $recaptcha->addValidator(‘required’);
    $recaptcha->addValidator(‘recaptcha’, array(‘secretKey’ => ‘/////’));
    $recaptcha->setIsHidden(true);
    $form->addElement($recaptcha);

    /** END FORM ELEMENT CONFIGURATION **/

    function process(Quform $form, array &$config)
    {
    // Process the form
    if ($form->isValid($_POST)) {
    // Custom code section #1 – see documentation for examples

    // End custom code section #1

    try {
    $attachments = array();
    $elements = $form->getElements();

    // Process uploaded files
    foreach ($elements as $element) {
    if ($element instanceof Quform_Element_File
    && array_key_exists($element->getName(), $_FILES)
    && is_array($_FILES[$element->getName()])) {
    $file = $_FILES[$element->getName()];

    if (is_array($file[‘error’])) {
    // Process multiple upload field
    foreach ($file[‘error’] as $key => $error) {
    if ($error === UPLOAD_ERR_OK) {
    $fileData = array(
    ‘path’ => $file[‘tmp_name’][$key],
    ‘filename’ => Quform_Element_File::filterFilename($file[‘name’][$key]),
    ‘type’ => $file[‘type’][$key],
    ‘size’ => $file[‘size’][$key]
    );

    if ($config[‘saveUploads’] && $element->getSave()) {
    $result = Quform_Element_File::saveUpload($config[‘uploadPath’], $config[‘uploadUrl’], $fileData, $element);

    if (is_array($result)) {
    $fileData = $result;
    }
    }

    if ($element->getAttach()) {
    $attachments[] = $fileData;
    }

    $element->addFile($fileData);
    }
    }
    } else {
    // Process single upload field
    if ($file[‘error’] === UPLOAD_ERR_OK) {
    $fileData = array(
    ‘path’ => $file[‘tmp_name’],
    ‘filename’ => Quform_Element_File::filterFilename($file[‘name’]),
    ‘type’ => $file[‘type’],
    ‘size’ => $file[‘size’]
    );

    if ($config[‘saveUploads’] && $element->getSave()) {
    $result = Quform_Element_File::saveUpload($config[‘uploadPath’], $config[‘uploadUrl’], $fileData, $element);

    if (is_array($result)) {
    $fileData = $result;
    }
    }

    if ($element->getAttach()) {
    $attachments[] = $fileData;
    }

    $element->addFile($fileData);
    }
    }
    } // element exists in $_FILES
    } // foreach element

    // Save to a MySQL database
    if ($config[‘database’]) {
    /* Step 1: set connection details */
    $db = new mysqli(‘localhost’, ‘username’, ‘password’, ‘database’);

    /* Step 2: set the database table */
    $table = ‘table’;

    if ($db->connect_errno) {
    die(‘Unable to connect to database: ‘ . $db->connect_error);
    }

    if (strtolower(QUFORM_CHARSET) == ‘utf-8’) {
    if (!$db->set_charset(‘utf8’)) {
    die(‘Error loading character set utf8 [‘ . $db->errno . ‘]: ‘ . $db->error);
    }
    }

    /* Step 3: configure the data to save */
    $data = array(
    ‘name’ => $form->getValue(‘name’),
    ’email’ => $form->getValue(’email’),
    ‘message’ => $form->getValue(‘message’),
    );

    $columns = implode(“, “, array_keys($data));
    $values = array_map(array($db, ‘real_escape_string’), array_values($data));
    $values = implode(“‘, ‘”, $values);

    $query = “INSERT INTO $table ($columns) VALUES (‘$values’)”;

    if (!$db->query($query)) {
    die(‘Query error [‘ . $db->errno . ‘]: ‘ . $db->error . “\n\n” . $query);
    }

    $db->close();
    }

    if ($config[’email’]) {
    // Get a new PHPMailer instance
    $mailer = Quform::newPHPMailer($config[‘smtp’]);

    // Set the from information
    $from = $form->parseEmailRecipient($config[‘from’]);

    if ($from[’email’]) {
    $mailer->setFrom($from[’email’], $from[‘name’]);
    }

    // Set the Reply-To header of the email as the submitted email address from the form
    if (!empty($config[‘replyTo’])) {
    $replyTo = $form->parseEmailRecipient($config[‘replyTo’]);

    if ($replyTo[’email’]) {
    $mailer->addReplyTo($replyTo[’email’], $replyTo[‘name’]);
    }
    }

    // Set the subject
    $mailer->Subject = $form->replacePlaceholderValues($config[‘subject’]);

    if (empty($config[‘recipients’])) {
    die(“You haven’t entered a recipient email address in the form process file.\n\n” . __FILE__);
    }

    // Set the recipients
    foreach ((array) $config[‘recipients’] as $recipient) {
    $mailer->addAddress($recipient);
    }

    // Set the message body HTML
    ob_start();
    include QUFORM_ROOT . $config[’emailBody’];
    $mailer->msgHTML(ob_get_clean());

    $mailer->AltBody = ‘To view this email please use HTML compatible email software.’;

    // Add any attachments
    foreach ($attachments as $attachment) {
    $mailer->addAttachment($attachment[‘path’], $attachment[‘filename’], ‘base64’, $attachment[‘type’]);
    }

    // Send the notification message
    $mailer->send();
    }

    // Autoreply email
    if ($config[‘autoreply’]) {
    $autoreplyRecipient = $form->parseEmailRecipient($config[‘autoreplyRecipient’]);

    if ($autoreplyRecipient[’email’]) {
    // Create the autoreply message
    $mailer = Quform::newPHPMailer($config[‘smtp’]);

    // Set the from address
    $autoreplyFrom = $form->parseEmailRecipient($config[‘autoreplyFrom’]);

    if ($autoreplyFrom[’email’]) {
    $mailer->setFrom($autoreplyFrom[’email’], $autoreplyFrom[‘name’]);
    }

    // Set the recipient
    $mailer->addAddress($autoreplyRecipient[’email’], $autoreplyRecipient[‘name’]);

    // Set the subject
    $mailer->Subject = $form->replacePlaceholderValues($config[‘autoreplySubject’]);

    // Set the message body HTML
    ob_start();
    include QUFORM_ROOT . $config[‘autoreplyBody’];
    $mailer->msgHTML(ob_get_clean());

    $mailer->AltBody = ‘To view this email please use HTML compatible email software.’;

    // Send the autoreply
    $mailer->send();
    }
    }

    // Custom code section #2 – see documentation for examples

    // End custom code section #2
    } catch (Exception $e) {
    if (QUFORM_DEBUG) {
    throw $e;
    }
    }
    } else {
    // Form data failed validation
    return false;
    }

    // Form processed successfully
    return true;
    }

    if (process($form, $config)) {
    $result = array(‘type’ => ‘success’);
    if (strlen($config[‘redirect’])) {
    $result[‘redirect’] = $config[‘redirect’];
    } else {
    $result[‘message’] = $form->replacePlaceholderValues($config[‘successMessage’]);
    }
    } else {
    $result = array(‘type’ => ‘error’, ‘error’ => $form->getError(), ‘elementErrors’ => $form->getElementErrors());
    }

    if (isset($_POST[‘quform_ajax’]) && $_POST[‘quform_ajax’] == 1) {
    $response = ‘<textarea>’ . Quform::jsonEncode($result) . ‘</textarea>’;
    } else {
    if (isset($result[‘type’], $result[‘redirect’]) && $result[‘type’] == ‘success’ && strlen($result[‘redirect’]) && !headers_sent()) {
    header(‘Location: ‘ . $result[‘redirect’]);
    exit;
    }

    ob_start();
    require_once ‘nojs.php’;
    $response = ob_get_clean();
    }

    echo $response;

    #26782
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #26791
    pankicid
    Participant

    Hi, thanks for your quick support, that solve the problem. And sorry for that semicolon I haven’t seen it.
    Have a great day

    #29171
    lilmissr
    Participant

    Hi I have the same error message it says and ajax error occurred when I try and submit the form. I have followed the tutorial for to add the processor to an existing form.

    Thanks

    #29172
    lilmissr
    Participant

    Here is an example of the code I used
    <form class=”quform” action=”/quform/process.php”>
    <div class=”row”>
    <div class=”quform-elements”>
    <div class=”col-md-6″>
    <div class=”form-group”>
    <div class=”quform-input”>
    <input class=”form-control” placeholder=”Name”type=”text”/>
    </div>
    </div>
    </div>
    <div class=”col-md-6″>
    <div class=”form-group”>
    <div class=”quform-input”>
    <input class=”form-control” placeholder=”Email” type=”text”/>
    </div>
    </div>
    </div>
    </div>
    </form>

    #29188
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #31741
    dotsk
    Participant

    Hi,

    Same issue here. Have emailed info@themecatcher.net

    Can someone get back to me?

    Cheers

    #31745
    Allan
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #31746
    dotsk
    Participant

    Thanks Allan

    #33032

    I just purchased this script and get the same error right out of the box before and after editing the process.php file.
    I also tried a custom form that is online at coloradomaintenancesolutions.com

Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy