Forum

Thread tagged as: Question, Problem, Configuration

Form auto response

Hi there,

Getting some strange behaviours with forms at the moment. I've setup all the information so that the user will get a message on the submission of a form and the admin will also get the information submitted. On my newest website straight up doesn't send anything.

The test email sends fine, and I've got the email setup in my config. I've tried debugging the page, but no errors occur on for submission that would point to any obvious issues.

I then went to my own site - now running an older version of perch - and tried the same. Initially I was getting the responses, however they've not stopped working for no obvious reason.

My form looks like:

<header class="user-Form_Header">
    <h1><perch:content id="heading" type="text" label="Heading" required="true" /></h1>
</header>
<div class="user-Form_Form">
    <perch:form id="contact" method="post" app="perch_forms" role="form">

        <div class="input">
            <perch:label for="name">Name:</perch:label>
            <perch:input id="name" type="text" antispam="name" required="true" placeholder="Name" label="name" />
            <span class="input__error"><perch:error for="name" type="required"><p>This field is required</p></perch:error></span>
        </div>

        <div class="input">
            <perch:label for="email">Email:</perch:label>
            <perch:input id="email" type="email" antispam="email" required="true" placeholder="Email" label="email" />
            <span class="input__error">
                <perch:error for="email" type="required"><p>This field is required</p></perch:error>
                <perch:error for="email" type="format"><p>Please enter a valid email</p></perch:error>
            </span>
        </div>

        <div class="input">
            <perch:label for="subject">Subject:</perch:label>
            <perch:input id="subject" type="text" antispam="subject" required="true" placeholder="Subject" label="subject" />
            <span class="input__error"><perch:error for="subject" type="required"><p>This field is required</p></perch:error></span>
        </div>

        <div class="input">
            <perch:label for="telephone">Tel:</perch:label>
            <perch:input id="telephone" type="text" placeholder="Telephone No." label="telephone" />
        </div>

        <div class="input">
            <perch:label for="message">Message:</perch:label>
            <perch:input id="message" type="textarea" antispam="message" required="true" placeholder="Message" label="message" />
            <span class="input__error"><perch:error for="message" type="required"><p>This field is required</p></perch:error></span>
        </div>

        <perch:input type="submit" id="submit" class="int-Button int-Button_Med int-Button_Yellow" value="Send" />

        <perch:after>
            <perch:success>
                <div class="contact-form__alert alert--thanks">

                <perch:content id="success" type="textarea" label="Thank you message" textile="true" editor="markitup" />

                </div>
            </perch:success>
        </perch:after>

    </perch:form>
</div>
Mathew Doidge

Mathew Doidge 2 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

So they were working, and now they're not, but nothing has changed?

Sorry drew, I had so many sites open I was getting confused. So the site in question has never worked and my debug is now showing a series of errors:

Debug Message
[27] SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0
[1] SELECT * FROM perch2_forms WHERE formKey='contact' LIMIT 1
[1] SELECT * FROM perch2_pages WHERE pagePath='/contact.php' LIMIT 1
Building message with Dollar template
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Using email template: /home/properformance/public_html/perch/core/emails/.txt (txt)
Building message with Dollar template
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Invalid query: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
Using template: /templates/pages/attributes/default.html
Using sub-template: /templates/pages/attributes/seo.html
Using sub-template: /templates/pages/attributes/facebook.html
Using sub-template: /templates/pages/attributes/twitter.html
SELECT * FROM perch2_pages WHERE pageNew=0 AND pageHidden=0 AND pageDepth >=0 AND pageDepth<=2 ORDER BY pageTreePosition ASC
Invalid query: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
SELECT regionKey, regionHTML FROM perch2_content_regions WHERE regionPage='/contact.php' OR regionPage='*' ORDER BY regionPage DESC
Invalid query: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
SELECT pageID FROM perch2_pages WHERE pagePath='/contact.php' LIMIT 1
[0] Invalid query: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
INSERT INTO perch2_pages(pagePath,pageTitle,pageNavText,pageNew,pageDepth,pageModified,pageAttributes) SELECT '/contact.php' AS pagePath,'Contact' AS pageTitle,'Contact' AS pageNavText,1 AS pageNew,0 AS pageDepth,'2016-08-05 20:41:42' AS pageModified,'' AS pageAttributes FROM (SELECT 1) AS ptable WHERE ( SELECT COUNT(*) FROM perch2_pages WHERE pagePath='/contact.php' )=0 LIMIT 1
Invalid query: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away

Array
(
    [type] => 2
    [message] => Error while sending QUERY packet. PID=99649
    [file] => /home/properformance/public_html/perch/core/lib/PerchDB_MySQL.class.php
    [line] => 119
)

I've checked with my host and the port 465 is allowed, as my initial thought was that it was being blocked.

My config file has the following:

define('PERCH_EMAIL_METHOD', 'smtp');
define('PERCH_EMAIL_HOST', 'smtp.gmail.com');
define('PERCH_EMAIL_AUTH', true);
define('PERCH_EMAIL_SECURE', 'ssl');
define('PERCH_EMAIL_PORT', 465);
define('PERCH_EMAIL_USERNAME', 'email@domain.uk.com');
define('PERCH_EMAIL_PASSWORD', "password");
Rachel Andrew

Rachel Andrew 394 points
Perch Support

You are getting errors like "MySQL Server has gone away", "Error sending query packet". These don't come from Perch so you would need to speak to your host.

Hi Rachel,

Strangely it works when I remove the config code I posted above. Not sure how it does without anything at all, but it's sending fine and no errors.