We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Contact Form using Contact Module on Website Is Downloading Submission Instead of Posting

How Do I?

TheDigicore's avatar
TheDigicore
12 posts
4 years ago
TheDigicore's avatar TheDigicore

Hi,

I have an install of the latest version of EE on my webspace and have the website set up. It is a 1 page solution.

The only issue I am encountering is with the Contact Module; when I go to submit the form it is downloading the message instead of posting it. The website is working on an SSL subdirectory basis as that is how the hosting provider allows native SSL ability for the website.

When I send a test mail through the backend “Developer > Utilities > Communicate” the test email goes through to the desired receipt however as previously stated on the front end homepage the form does not send, it just downloads.

My code for the EE module is:

{exp:email:contact_form user_recipients="no" recipients="[email protected]" charset="utf-8" form_class="needs-validation" form_id="contact-form" return="https://clarahost.clara.net/www.aftech-engineering.co.uk/" redirect='0'}
   
   <input type="hidden" name="from" size="40" value="Enquiry From Website" />
   <input type="hidden" name="to" size="40" value="[email protected]" />
 
     <div class="row">
    <div class="col-md-6 mb-4 pb-2">
      <label for="Name">Name</label>
      <input type="text" class="form-control" id="Name" placeholder="Name" name="name" value="" required>
      <div class="invalid-tooltip">
     Please enter your name
      </div>
      <div class="valid-tooltip">
     Brilliant - Thanks!
      </div>
     
    </div>
    
    <div class="col-md-6 mb-4 pb-2">
      <label for="Email">Email</label>
      <input type="email" class="form-control"  aria-describedby="emailHelp" id="from" name="from" placeholder="Email" value="" required>
      <div class="invalid-tooltip">
     Please enter a valid email address
      </div>
      <div class="valid-tooltip">
     Brilliant - Thanks!
      </div>
    </div>
     </div>
     
     <div class="row">
      <div class="col-md-12 mb-4 pb-2">
     <label for="Message">Message</label>
     <textarea name="message" class="form-control" id="Message" placeholder="Message" rows="5" required></textarea>
     <div class="invalid-tooltip">
      Please enter an appropriate message
     </div>
      <div class="valid-tooltip">
     Brilliant - Thanks!
      </div>
     </div>
     </div>
     
    <div class="form-group">
    <div class="form-check">
      {if captcha}
        Please enter the word you see in the image below:
        {captcha}<input type="text" name="captcha" value="" maxlength="20" class="ml-0 ml-md-2" /></p>
      {/if}
    </div>
     </div>
     <input class="px-5 py-2 btn float-right btn-block btn-lg text-uppercase" name="submit" type='submit' value='Submit' />
     
   {/exp:email:contact_form}

The website is: www.aftech-engineering.co.uk/

The contact form is found at the bottom of the page.

Any help with this would be very much appreciated.

Thanks

       
Robin Sowell's avatar
Robin Sowell
13,158 posts
4 years ago
Robin Sowell's avatar Robin Sowell

I’d ping the host and ask- I’m not sure I’ve seen that before. I’d personally toss up a copy of the form and just have it post back to itself and see if that works.

Plus www.aftech-engineering.co.uk/ is redirecting.

But this looks like something the host will need to resolve.

       
TheDigicore's avatar
TheDigicore
12 posts
4 years ago
TheDigicore's avatar TheDigicore

Thanks Rob,

How would I get the form to post back to itself?

       
Robin Sowell's avatar
Robin Sowell
13,158 posts
4 years ago
Robin Sowell's avatar Robin Sowell

Ah- sorry. I’d make a file named test.php and I’d put this on it:

<form id="contact-form" class="needs-validation" method="post" action=""  >
<div class='hiddenFields'>
<input type="hidden" name="ACT" value="25" />
<input type="hidden" name="RET" value="https://clarahost.clara.net/www.aftech-engineering.co.uk/" />
<input type="hidden" name="URI" value="index" />
<input type="hidden" name="PRV" value="" />
<input type="hidden" name="recipients" value="uRQwNZEl0sJakkGRZJ1NQ7Ha05DUAt+Pbjx0wTaK+8jXieBf+EtkoowIoj+7UXMkSGytKppBfdHuaGXDYFPMzQ==" />
<input type="hidden" name="user_recipients" value="DuV4zGIHI8vZ60Cg4uKQnbQg3+u7BGVMNSi02zTH45o=" />
<input type="hidden" name="charset" value="utf-8" />
<input type="hidden" name="allow_attachments" value="912SQz8yugKiJvHV3g7XD28hyvTHUUehbQ/KHyCONbeZqSHgdkCo6YSZy3ZkEcvN" />
<input type="hidden" name="redirect" value="0" />
<input type="hidden" name="replyto" value="" />
<input type="hidden" name="markdown" value="sG7h6U7ArScZ3puVk6xN8BhHBpQVYuONyUv5jzMwEjc=" />
<input type="hidden" name="site_id" value="1" />
<input type="hidden" name="csrf_token" value="8727bd427001b94b82f77f11bf95b52ee14013cb" />
</div>


   
   <input type="hidden" name="from" size="40" value="Enquiry From Website" />
   <input type="hidden" name="to" size="40" value="[email protected]" />
 
     <div class="row">
    <div class="col-md-6 mb-4 pb-2">
      <label for="Name">Name</label>
      <input type="text" class="form-control" id="Name" placeholder="Name" name="name" value="" required>
      <div class="invalid-tooltip">
     Please enter your name
      </div>
      <div class="valid-tooltip">
     Brilliant - Thanks!
      </div>
     
    </div>
    
    <div class="col-md-6 mb-4 pb-2">
      <label for="Email">Email</label>
      <input type="email" class="form-control"  aria-describedby="emailHelp" id="from" name="from" placeholder="Email" value="" required>
      <div class="invalid-tooltip">
     Please enter a valid email address
      </div>
      <div class="valid-tooltip">
     Brilliant - Thanks!
      </div>
    </div>
     </div>
     
     <div class="row">
      <div class="col-md-12 mb-4 pb-2">
     <label for="Message">Message</label>
     <textarea name="message" class="form-control" id="Message" placeholder="Message" rows="5" required></textarea>
     <div class="invalid-tooltip">
      Please enter an appropriate message
     </div>
      <div class="valid-tooltip">
     Brilliant - Thanks!
      </div>
     </div>
     </div>
     
    <div class="form-group">
    <div class="form-check">
      
        Please enter the word you see in the image below:
        images/captchas/1600119821.5364.jpg<input type="text" name="captcha" value="" maxlength="20" class="ml-0 ml-md-2" /></p>
      
    </div>
     </div>
     <input class="px-5 py-2 btn float-right btn-block btn-lg text-uppercase" name="submit" type='submit' value='Submit' />
     
   </form>

Submit the form, let’s see if it works. Note- it’s not going to do anything/send emails. It should just reload the page with all the posted data in a big messy lump at the top of the page.

       
TheDigicore's avatar
TheDigicore
12 posts
4 years ago
TheDigicore's avatar TheDigicore

Hi Rob,

Thanks for the help with this.

I created the page as per your instructions and it seems to post and redirect back however the input data is not being shown at the top of the page.

Please see the link to the page here: Form Test

       
Robin Sowell's avatar
Robin Sowell
13,158 posts
4 years ago
Robin Sowell's avatar Robin Sowell

Partly my bad- add this at the top of the page:

<?php print_r($_POST); ?>



<hr>

But I actually think it’s working- no redirects or anything.

       
TheDigicore's avatar
TheDigicore
12 posts
4 years ago
TheDigicore's avatar TheDigicore

Thanks,

It seems to work. Can not quite grasp why the EE install is not working as it should, maybe I need to setup a thank you page?

       
TheDigicore's avatar
TheDigicore
12 posts
4 years ago
TheDigicore's avatar TheDigicore

Would you have any advice on why the EE install is not parsing the form correctly however the standalone test page can?

I have even tried the contact templates form and it is not working, when I open the downloaded file I get:

Status: 404 Content-Type: text/html

Virtual host not found on this server

Thanks

       
Robin Sowell's avatar
Robin Sowell
13,158 posts
4 years ago
Robin Sowell's avatar Robin Sowell

Take a look at your path and url settings- for your base_url set it to https://clarahost.clara.net/www.aftech-engineering.co.uk/ and for your site_url set it to {base_url}.

Right now, it looks like it’s posting to https://clarahost.clara.net. And you can’t get to www.aftech-engineering.co.uk - that’s redirecting to https://clarahost.clara.net/www.aftech-engineering.co.uk/.

Let’s see if that helps. You can change it back once the domain is setup.

       
TheDigicore's avatar
TheDigicore
12 posts
4 years ago
TheDigicore's avatar TheDigicore

Thanks for your help, that worked. I removed it previously as it was causing the backend to break.

       
Robin Sowell's avatar
Robin Sowell
13,158 posts
4 years ago
Robin Sowell's avatar Robin Sowell

Glad that was it! I was missing the bad action url because we were getting such a weird error!

Just make sure to use {base_url} and {base_path} in all of your control panel settings and then when you need to change it to the real url and go live, you’ll only need to edit it in that one spot.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.