OpenCart Support Services

Want to extend your store, edit or create new designs, add custom features or fix broken ones for your OpenCart store? We offer a range of development and SEO services. Click here to get in touch

Adding Custom OpenCart Contact Forms For Quotes, Leads and Marketing

By Jack
In OpenCart
Mar 23rd, 2012
60 Comments
17913 Views

OK, so a lot of people are asking about changing the Contact Page in the default OpenCart system so it doesn’t so…well, crap! I was going to write a short blog post about redesigning the page with stuff that is already there but I thought I would do it properly and show you a method of creating several different contact forms which you could use throughout your OpenCart website.

So, I will be creating three different contact forms:

  • Lead Generation Form
    This will be a form which sits on the homepage and encourages visitors to sign up to your Newsletter, RSS Feed or some other Lead Gen method.
  • Request A Quote Form
    Another popular request for OpenCart users, this will be a form which sits next to the product description which usrs can fill out for more information, or a quote, to be sent to them by the Store Owner.
  • A Bespoke Contact Form
    I will be replacing the original OpenCart contact page with a bespoke Information page with a new contact form. By doing it this way, we can define exactly how the contact page looks!

We will build up the forms individually and then build a PHP file to handle the different requests with an “IF” statement so we keep it all together. You will be able to customise the emails that get sent in the forms of confirmations to fit with your branding.

Adding a Sign Up form to the OpenCart homepage for Lead Generation

So, first we are going to be making up the form which will sit on the OpenCart homepage and allows your customers to sign up and for you to start getting leads from your store. In this example I will creating a Newsletter Form which only requires the visitors full name and email address.

The form itself is pretty standard and you only need a bit of HTML knowledge to make one up, the form I will make will be unstyled but remember you can give each input type a different class to style them with the OpenCart CSS file to make it look how you want!

Building The Lead Generation Form

Open us this file:

  • catalog/view/theme/[YOUR THEME]/template/common/home.tpl

And add in your form wherever you want it to appear on the home page. Simply follow the structure as shown below:

<form action="http://[YOUR STORE URL]/phpForm.php" method="post" enctype="multipart/form-data" name="leadForm">
<h2>Join Our Mailing List</h2>
<table>
<tr>
<td>First Name</td>
<td><input type="text" name="leadFirstName" /></td>
</tr>
<tr>
<td>Last Name</td>
<td><input type="text" name="leadLastName" /></td>
</tr>
<tr>
<td>Email Address</td>
<td><input type="text" name="leadEmail" /></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Join Our Mailing List" /></td>
</tr>
</form>

Right, so now we have a very basic form which just asks for a few details off our visitor to sign up for the OpenCart Store Newsletter. Remember to keep the input names otherwise it won’t work later on!

Processing The Lead Generation Form With PHP

Open up a blank file in your Text Editor and name it “phpForm.php“. This is the file we will be making to process the data when the user submits the Newsletter Sign Up form on your homepage. The add the following:

<?php
//Checks if the submitted form is the Lead Gen
if($_POST["leadFirstName"]){

//Secure The Submitted Data
$leadFirstName = stripslashes($_POST["leadFirstName"]);
$leadLastName = stripslashes($_POST["leadFirstName"]);
$leadEmail = stripslashes($_POST["leadEmail"]);

//Build The Email To The Admin
$to = "[PUT YOUR ADMIN EMAIL ADDRESS HERE]";
$subject = "Newsletter Sign Up Details";
$theEmail = "Please add $leadFirstName $leadLastName to the mailing list, email address is $leadEmail";
$headers = "Content-type: text/htmlrn";
$headers .= "From: admin@youropencartstore.comrn";
mail($to, $subject, $theEmail, $headers);

//Build Confirmation Email To The Customer
$to2 = "$leadEmail";
$subject2 = "Thanks for signing up to OpenCart Store!";
$theEmail2 = "
<h1>Thanks for joing our mailing list!</h1>
<p>We're glad to have you on board and hope you really enjoy the newsletter!</p>
<p>Kind Regards,</p>
<p>The OpenCart Store Team</p>";

$headers2 = "Content-type: text/htmlrn";
$headers2 .= "From: mail@youropencartstore.comrn";
mail($to2, $subject2, $theEmail2, $headers2);

//Redirect Customer Back To Store
header("location: http://www.youropencartstore.com/thanks");
}

?>

Adding A Quote request Form To Your OpenCart Store

In this section we will be building up the Quote Request Form to be placed on product pages where customers can ask for more information or a bespoke price for the product. We will be following a similar process to the Lead Generation form but changing the following file instead:

  • catalog/view/theme/[YOUR THEME]/template/product/product.tpl

Again, just choose where you want the form to be shown and go ahead!

Building The OpenCart Quote Request Form

Build another HTML for for the user to fill out but this time we will be getting some hidden details from the page so the admin knows which product the potential customer is talking about.

<form action="http://[YOUR STORE URL]/phpForm.php" method="post" enctype="multipart/form-data" name="quoteForm">
<h2>Get A Quote / More Information</h2>

//Get The Product Name
<input type="hidden" name="quoteProduct" value="<?php echo $product["name"]; ?>" />

<table>
<tr>
<td>First Name</td>
<td><input type="text" name="quoteFirstName" /></td>
</tr>
<tr>
<td>Last Name</td>
<td><input type="text" name="quoteLastName" /></td>
</tr>
<tr>
<td>Email Address</td>
<td><input type="text" name="quoteEmail" /></td>
</tr>
<tr>
<td>Details</td>
<td><textarea name="quoteDetails"></textarea></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Get A Quote" /></td>
</tr>
</form>

Adding The Quote Request Form Handling To Your PHP File

Now this needs to be added to the phpForm.php to handle the form when someone requests a quote through the OpenCart product pages.

<?php
//Checks if the submitted form is the Quote request
if($_POST["quoteFirstName"]){

//Secure The Submitted Data
$quoteFirstName = stripslashes($_POST["quoteFirstName"]);
$quoteLastName = stripslashes($_POST["quoteFirstName"]);
$quoteEmail = stripslashes($_POST["quoteEmail"]);
$quoteDetails = stripslashes($_POST["quoteDetails"]);
$quoteProduct = stripslashes($_POST["quoteProduct"]);

//Build The Email To The Admin
$to = "[PUT YOUR ADMIN EMAIL ADDRESS HERE]";
$subject = "Quote Request Details";
$theEmail = "$quoteFirstName $quoteLastName ($quoteEmail) is requesting a quote on $quoteProduct. Here is their message: $quoteDetails";
$headers = "Content-type: text/htmlrn";
$headers .= "From: admin@youropencartstore.comrn";
mail($to, $subject, $theEmail, $headers);

//Build Confirmation Email To The Customer
$to2 = "$quoteEmail";
$subject2 = "Thanks for requesting a quote!";
$theEmail2 = "
<h1>Thanks for asking for a quote!</h1>
<p>We will be back to you soon with some more details!</p>
<p>Kind Regards,</p>
<p>The OpenCart Store Team</p>";

$headers2 = "Content-type: text/html\r\n";
$headers2 .= "From: mail@youropencartstore.com\r\n";
mail($to2, $subject2, $theEmail2, $headers2);

//Redirect Customer Back To Store
header("location: http://www.youropencartstore.com/thanks");
}

?>

Building A Custom Contact Page In OpenCart

I’ve saved the biggest and baddest for last in this blog post! Now we will be looking at how to develop a custom contact page for your OpenCart store and there is a little bit of prep before we build the actual form. First thing to do is set a new information page which we can use as our contact page!

Building Your New OpenCart Contact Form

Log into your OpenCart admin panel and hover over the “Catalog” tab and choose “Information“. Then click the “INSERT” button to create a new Information page. For SEO purposes, as well as being more user friendly, I would recommend having the SEO keyword just set to “contact”, that way your contact page will simply be “www.youropencartstore.com/contact” rather than having all the route rubbish which is in the default contact page.

Then you will need to add your form onto the information page directly through the OpenCart admin panel. Remember to make sure you have selected “HTML” in the content field so your form gets put in correctly! Then add the following form:

<form action="http://[YOUR STORE URL]/phpForm.php" method="post" enctype="multipart/form-data" name="contactForm">
<h2>Contact Us</h2>
<table>
<tr>
<td>First Name</td>
<td><input type="text" name="contactFirstName" /></td>
</tr>
<tr>
<td>Last Name</td>
<td><input type="text" name="contactLastName" /></td>
</tr>
<tr>
<td>Email Address</td>
<td><input type="text" name="contactEmail" /></td>
</tr>
<tr>
<td>Message</td>
<td><textarea name="contactMessage"></textarea></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Send!" /></td>
</tr>
</form>

Nice and easy right? Now we just need to build up the final PHP handle to process the contact form when it is sent!

Processing The OpenCart Contact Form

This is actually very similar to the Lead Generation form we sent in the first part of this tutorial, we just need to change a few words around and we have the final addition to our phpForm.php file which processes when your new contact form is submitted.

<?php
//Checks if the submitted form is the Lead Gen
if($_POST["contactFirstName"]){

//Secure The Submitted Data
$contactFirstName = stripslashes($_POST["contactFirstName"]);
$contactLastName = stripslashes($_POST["contactLastName"]);
$contactEmail = stripslashes($_POST["contactEmail"]);
$contactMessage = stripslashes($_POST["contactMessage"]);

//Build The Email To The Admin
$to = "[PUT YOUR ADMIN EMAIL ADDRESS HERE]";
$subject = "Contact form Submitted";
$theEmail = "$contactFirstName $contactLastName ($contactEmail) sent a message through your form! Their message was: $contactMessage";
$headers = "Content-type: text/htmlrn";
$headers .= "From: admin@youropencartstore.comrn";
mail($to, $subject, $theEmail, $headers);

//Build Confirmation Email To The Customer
$to2 = "$leadEmail";
$subject2 = "Thanks, we have your message!";
$theEmail2 = "
<h1>Thanks for your message!</h1>
<p>We're reading it now and will be in touch shortly!</p>
<p>Kind Regards,</p>
<p>The OpenCart Store Team</p>";

$headers2 = "Content-type: text/html\r\n";
$headers2 .= "From: mail@youropencartstore.com\r\n";
mail($to2, $subject2, $theEmail2, $headers2);

//Redirect Customer Back To Store
header("location: http://www.youropencartstore.com/thanks");
}

?>

Finishing Up

Remember to put in your details where you can, and the emails are set as HTML so a reasonable amount of tags can be used buit always remember that different people will have different email programs which means your emails may look different to different people. It is always important to try and cater to all technologies when Marketing and try and include your logo if you can for branding!

You will also need to upload your phpForm.php file to the root folder of your OpenCart store or there will be nothing there to process the submitted form. If you have a store on a subdomain you will need to edit the form action tag and the redirect function in the PHP file to reflect this.

By having your bespoke contact form it means that you not only have an SEO friendly contact page URL, but you can also style the page to fit in with the rest of your website without having to deal with the contact page template. You may have to remove the old “Contact” link from the Nav Bar and replace it with your new contact URL, if you don’t know how to do this then have a look at another one of my blogs which shows you exactly how it is done here.

Apart from that, we’re all done. If you have a good working knowledge of PHP then you will be able to edit the form for different requirements. If you don’t you can hire me to work on your project, just send me a message from the Contact Page. If you have any questions as always just leave me a comment and I will get back to you!

Posted By

Has 66 Posts

The founder of Cart Advisor, is an eCommerce developer specialising in OpenCart development and content SEO. Based in Lincoln, UK, Jack has worked with hundreds of businesses and runs his own company Destrove which offers OpenCart Development, OpenCart Theme Design and more.

60 Responses to “Adding Custom OpenCart Contact Forms For Quotes, Leads and Marketing”

  1. Jesse says:

    Good stuff. I’m brand new to OpenCart, and this is very helpful. One thing – I keep getting a unexpected T_STRING error for the line `header(“location: http://www.youropencartstore.com/thanks“);`, regardless of the URL that I plug in.

    • Hi Jesse,

      Sorry, should have put at the end that PHP will not return a header() function if there is something printed before it.

      So just remove all of my comments from the script and make sure that this code is the very first thing in the file.

      Cheers,

      Jack

    • Jesse says:

      OK, now I’m getting an unexpected $end error, possible due to the fact that the whole function is wrapped in an if statement?

      I tried this, but no good…

      //Redirect Customer Back To Store
      header(“location: http://www.vermifactory.com/opencart/thanks“);

      <?php
      if($_POST["contactFirstName"]){

      $contactFirstName = stripslashes($_POST["contactFirstName"]);
      $contactLastName = stripslashes($_POST["contactFirstName"]);
      $contactEmail = stripslashes($_POST["contactEmail"]);
      $contactMessage = stripslashes($_POST["contactMessage"]);

      $to = "[info@vermifactory]";
      $subject = "Contact form Submitted";
      $theEmail = "$contactFirstName $contactLastName ($contactEmail) sent a message through your form! Their message was: $contactMessage";
      $headers = "Content-type: text/htmlrn";
      $headers .= "From: info@vermifactory.comrn";
      mail($to, $subject, $theEmail, $headers);

      $to2 = "$leadEmail";
      $subject2 = "Thanks, we received your message!";
      $theEmail2 = "
      Thanks for your message!
      We’re reading it now and will be in touch shortly!
      Kind Regards,
      The Vermifactory Team”;

      $headers2 = “Content-type: text/htmlrn”;
      $headers2 .= “From: info@vermifactory.comrn“;”;
      mail($to2, $subject2, $theEmail2, $headers2);
      }
      endif; ?>

    • OK,

      On the $headers2, you have ended the line with “;”; when you only need “; (That’s a mistake on my end, sorry!)
      You can remove the “endif;” it isn’t needed
      Remove the //Redirect Customer Back… comment above the header function

      Let me know if this helps…

      Jack

    • Jesse says:

      Solved! Cheers, Jack. Thanks for the help and the great solution!

    • Nice one!

      Cheers Jesse!

  2. Hi Jack

    Managed to get the quote form working with just one hitch: it’s not pulling in the product details to let me know which product the mail refers to. It just reflects a blank. I’ve tried all sorts but I’m just too green to figure it out! Any ideas?

    AmandaLeighOC

    • Hi Amanda-Leigh,

      Sorry, completely my fault! I forgot to put the handler on the PHP file code for the product name. I’ve added it in so if you copy the PHP code from the block again and put it in your file then it should include your product name.

      Give me a shout if there are any problems.

      Cheers,

      Jack

  3. paul says:

    Quick question please.

    Should this line:

    $contactLastName = stripslashes($_POST["contactFirstName"]);

    be as is, or should it be

    $contactLastName = stripslashes($_POST["contactLastName"]);

    Thanks.

  4. Kelly says:

    Does adding the quote request for add it to all products, or can you select the products you’d like it to appear by?

    • Hi Kelly,

      As it is written this will add a quote form on every product page but if you’re willing to be creative with it there is nothing to stop you using IF statements on the page title (or maybe on a unique product attribute) to select certain pages for it to appear

      Cheers,

      Jack

  5. Jacqueline says:

    Thanks for this. But how do I actually make the form work?

    Where exactly do I put the php file?

  6. Jacqueline says:

    Still doesn’t work >.<

  7. lee says:

    Hi mate love the tutorial but have a problem. I am trying to make a simple subscribe form in the footer of my opencart site. i have gone to the footer.tpl and have entered a form with two input fields and a button. The problem is the button is not clicking at all. its acting like an image with no button mechanism…Any ideas. Thanks

  8. Willem says:

    Can you also add a error message or page? When customers leave required fields blank.

  9. Johan says:

    Hi!

    It works perfect for me, except one thing.
    I dont get any email to the email-adress i did put under //Build The Email To The Admin
    $to =

    Any clues?

    Thanks in advance.

    • Hi Johan,

      Have you made any changes to the code? Could you email them to me in a text file and I’ll see what is going wrong. Also, ensure that your web hosting provider supports the mail() function, do you get other messages from the store when the contact form and checkout form are completed?

      Cheers,

      Jack

  10. Hello Jack,

    I want the newsletter in my footer part of the home page of website. I got your first code of the form which i have put into footer.tpl page in direcoty. But now i didn’t getting you for the phpForm.php file, where i will have to put this in the opencart files. I only want the email field to send newsletter. You can send the solution on my mail id. I am waiting in you answer. Please provide me the solution as soon as possible.

    Thanks in advance,
    Regards,
    Ruchi Agrawal

    • Jack Davis says:

      Hi,

      You can put the phpForm in the root folder of your site, the folder which has the admin, catalog, image, system folders etc at the very start of your website in FTP or File Manager.

      Cheers,

      Jack

  11. john says:

    where is the root folder located?

    • Jack Davis says:

      The root folder is the one which OpenCart is installed in, it’s not actually called “root” most of the time. Try looking for the folder which holds your OpenCart store, it will be the one with the admin, catalog, image, system folder with the index.php and config.php file. That one is the root folder.

      Cheers,

      Jack

  12. Khadri says:

    pls how am i going to write the url address in the form action,an example will be appreciated

    • Jack Davis says:

      If I was to set it up on this website I would write:

      <form action=”http://www.[cartadvisor].com/phpForm.php”… etc

      Without the square brackets of course!

      Cheers,

      Jack

  13. Kealan says:

    Jack,

    Just a quick shout to say thanks very much this worked a treat. I also found http://forumone.com/blogs/post/replacing-form-buttons-images helped for the finishing touches to your work.

    Cheers

    K

  14. Daniel says:

    I have uploaded and followed your instructions for the bespoke contact form…plus a little added field for products…and I have 3 issues.
    1. I get this error when I send the inquiry:”Warning: Cannot modify header information – headers already sent by (output started at /home/prest47/public_html/phpForm.php:1) in /home/prest47/public_html/phpForm.php on line 35″

    2. I get the emails with an attached separate text file versus part of the email.
    3. The email is from my website address versus the email I choose as the from.

    any help would be appreciated. btw – I am using Opencart 1.5.6

    • Jack Davis says:

      Hi Daniel,

      Please could you send me a message through the contact page and I will have a look through your code. Looks like there is something being called before the form which is causing a PHP error.

      Thanks,

      Jack

  15. Martin says:

    Hi Jack

    Im not getting the mail though the form? my contact form works and i get mail fine? Here is my code:

  16. Dalibor says:

    Hi Jack
    Thanks for your instructions. I succesffuly add your form on my opencart product page, but this form is havent got any validation for email for example. Is it hard to setup some validation on this form ? Other way is put opencart contact form on product page (default contact form have got validation and captcha) but I dont know how to get opencart form on product page…

  17. adil says:

    hi i want to make a form like http://callinmall.com/TOBI-Travel-Steamer-in-Pakistan can you help me

    • Hi,

      Ok this can be done by following the post above but just adding the extra fields and a select box then making sure the correctly named variables are passed in the php code which sends the email. If you need it developing then you probably need an OpenCart developer to do it for you as it is too specific for me to write out here.

      Hope this helps!

      Jack

  18. Thank you for this article. Very easy to follow and extremely helpful.

  19. Glyn says:

    Hello
    i have tried you mod, thank you so much.

    When testing it, i do not recieve an email to let me know someone has registered, please can you help ? do you know of a resilution

    Here is my snipits of code

    home.tpl

    Email Address

    <?php
    //Checks if the submitted form is the Lead Gen
    if($_POST["leadEmail"]){

    //Secure The Submitted Data
    $leadEmail = stripslashes($_POST["leadEmail"]);

    //Build The Email To The Admin
    $to = "[admin@carcodereaders.co.uk]";
    $subject = "Newsletter Sign Up Details";
    $theEmail = "Please add $leadEmail";
    $headers = "Content-type: text/htmlrn";
    $headers .= "From: admin@carcodereaders.co.uk";
    mail($to, $subject, $theEmail, $headers);

    ———————————————
    =============================================
    ———————————————

    //Build Confirmation Email To The Customer
    $to2 = "$leadEmail";
    $subject2 = "Thanks for signing up to CarCodeReaders.co.uk!";
    $theEmail2 = "
    Thanks for joing our mailing list!
    We’re glad to have you on board and hope you really enjoy the newsletter!
    Kind Regards,
    The CarCodeReaders.co.uk Team”;

    $headers2 = “Content-type: text/htmlrn”;
    $headers2 .= “From: admin@carcodereaders.co.uk“;
    mail($to2, $subject2, $theEmail2, $headers2);

    //Redirect Customer Back To Store
    header(“location: http://www.carcodereaders.co.uk“);
    }

    ?>

    Kind Regards

  20. Glyn says:

    Hello

    Sorry i seem to have missed a piece out in the last email, i have a feeling this is where the fault is but could be totally wrong
    $theEmail = “email address is $leadEmail”;

    The missing code is addded below

    //Build The Email To The Admin
    $to = “[admin@carcodereaders.co.uk]“;
    $subject = “Newsletter Sign Up Details”;
    $theEmail = “email address is $leadEmail”;
    $headers = “Content-type: text/htmlrn”;
    $headers .= “From: Admin@CarCodeReaders.co.uk“;
    mail($to, $subject, $theEmail, $headers);

  21. Craig says:

    I could really do with some help with adding forms if you have the time to email me.

    Kindest Regards

    Craig

  22. Gul says:

    hi thanks for the nice tutorial
    i want to make a signup form in my footer taking name and email of user ..then i want to email to myselft and user and i also want these values to be store in the database so i can also check in admin who has subscribed…i am new to opencart please help as u r master in this…….thanks in advance waiting for your kind response

  23. Alex says:

    Hi Jack, Great work!
    Would be possible to include a form for quotes in some products including a “sur-mesure” button like this… http://www.shaper.fr/surf_fishs?product_id=2787

    Regards,
    Alex

    • Jack says:

      Hi Alex,

      That is definitely possible but there is a lot of work there and a bit too specific to warrant a blog post as the needs could change based on the store. I guess you could use a simple JQuery .hide() and .show() trick to hide and reveal the form but you will probably want a developer to get the effect you want. Let me know if you want to discuss the project and get a quote.

      Thanks,

      Jack

    • Alex says:

      Hi Jack,
      Thank you for your answer. The problem would be to put this one in some products, not in all of them…

  24. alex says:

    Jack,

    this is awesome. how would you go about having these styled with the same css as the rest of your site?

    • Jack says:

      Hi Alex,

      Use Google Chrome and find another form on the site (such as the contact page), right click on the form elements and select “Inspect Element”. In the HTML code which pops up you should be able to see the class which is assigned, simply use this class on your own form inputs as well and the styling should be the same on both forms if the theme is built well :)

      Thanks,

      Jack

  25. Jazib says:

    Hi Jack
    I tried your tips and build a beautiful form but it doesn’t seem working. Is there anyway you can have look and debug it please?

    Below is the link of my form

    http://mirrorcity.info/index.php?route=product/category&path=6_5

  26. Hello, thanks for the code…

    I have this installed on my embroidery info page. I get the admin email, but the customer is not getting the confirmation email..here is what I have..

    <?php
    //Checks if the submitted form is the Lead Gen
    if($_POST["contactFirstName"]){

    //Secure The Submitted Data
    $contactFirstName = stripslashes($_POST["contactFirstName"]);
    $contactLastName = stripslashes($_POST["contactLastName"]);
    $contactEmail = stripslashes($_POST["contactEmail"]);
    $contactMessage = stripslashes($_POST["contactMessage"]);

    //Build The Email To The Admin
    $to = "[xxxxxxxxx]";
    $subject = "Contact form Submitted";
    $theEmail = "$contactFirstName $contactLastName ($contactEmail) sent a message through your form! Their message was: $contactMessage";
    $headers = "Content-type: text/html\r\n";
    $headers .= "From: admin@xxxxxxxx";
    mail($to, $subject, $theEmail, $headers);

    //Build Confirmation Email To The Customer
    $to2 = "$leadEmail";
    $subject2 = "Thanks, we have your message!";
    $theEmail2 = "
    Thanks for your message!
    We’re reading it now and will be in touch shortly!
    Kind Regards,
    BT Imprintables Sales”;

    $headers2 = “Content-type: text/html\r\n”;
    $headers2 .= “From: admin@xxxxxxxxx”;
    mail($to2, $subject2, $theEmail2, $headers2);

    //Redirect Customer Back To Store
    header(“location: http://www.xxxxxxx.com“);
    }

    ?>

    Thanks…

  27. Hi Thank you for this it helped me create a mod based on your post that suited my needs.

    I have uploaded the mod and included acknowledgement to you.

    http://www.opencart.com/index.php?route=extension/extension/info&token=0c1f6f49bc5fc4d54e6f92e87c39bd2c&extension_id=15619

    I hope this is ok.

    • Jack says:

      Hi Ben,

      Thank you for the acknowledgement, much appreciated. The mod looks cool, good luck with it and let me know if I can help you out with it in any way.

      Thanks,

      Jack

  28. Benji says:

    Hey Jack, I’ve implemented your form on a client’s site, but it seems the emails aren’t sending. I know the form is being processed though, as the redirect is working. Could this be due to the fact we’re using Google’s SMTP service to process emails on the site?

    • Jack says:

      Could be, is the server PHP mail() function turned off as well? Think some secure set ups restrict it.

      Cheers,

      Jack

  29. Benji says:

    I see. I’m currently working on using Googles SMTP service for my php mail() function. Hopefully this will work things out. I’ll be sure to reply back with my results.

  30. dan says:

    Hi,
    thank you for your blog post, exactly what I was looking for. I want to use the custom form you built. I have set up the information page with the html and uploaded the php file to the root. the form is showing up on my site, but when submitting the form, i get an error that says there is an unexpected “@” in the php file.
    Parse error: syntax error, unexpected ‘@’ in /home1/…/phpForm.php on line 12

    the error is referring to this line:

    $to = “[PUT YOUR ADMIN EMAIL ADDRESS HERE]“;

    i put my email address in there and that is when it gives me the error. I have tried leaving the square brackets and then it gives me the same error, but instead says unexpected ‘[‘

    any idea what I am doing wrong?

    thank you!

    • Jack says:

      Hi Dan,

      When I use square brackets, most of the time it is used as a placeholder to show that you need to enter something. You would enter your email address something like:

      $to = “this@ismyemailaddress.com”;

      Thanks,

      Jack

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>