the ajax Request not sending Email in php - php

i am using correct code, still the ajax request is not sending the email content-- Can anyone have a look and suggest me what i can do better to get an email
Here is the form :
<form method="post" action="process.php">
<div class="element">
<label>Name</label>
<input type="text" name="name" class="text" />
</div>
<div class="element">
<label>Email</label>
<input type="text" name="email" class="text" />
</div>
<div class="element">
<label>Phone </label>
<input type="text" name="website" class="text" />
</div>
<div class="element">
<label>Comment</label>
<textarea name="comment" class="text textarea" /></textarea>
</div>
<div class="element">
<input type="submit" id="submit"/>
<div class="loading"></div>
</div>
</form>
Here is the ajax request: --
<script type="text/javascript">
$(document).ready(function() {
//if submit button is clicked
$('#submit').click(function () {
//Get the data from all the fields
var name = $('input[name=name]');
var email = $('input[name=email]');
var website = $('input[name=website]');
var comment = $('textarea[name=comment]');
//Simple validation to make sure user entered something
//If error found, add hightlight class to the text field
if (name.val()=='') {
name.addClass('hightlight');
return false;
} else name.removeClass('hightlight');
if (email.val()=='') {
email.addClass('hightlight');
return false;
} else email.removeClass('hightlight');
if (comment.val()=='') {
comment.addClass('hightlight');
return false;
} else comment.removeClass('hightlight');
//organize the data properly
var data = 'name=' + name.val() + '&email=' + email.val() + '&website=' +
website.val() + '&comment=' + encodeURIComponent(comment.val());
//disabled all the text fields
$('.text').attr('enabled','false');
//show the loading sign
$('.loading').show();
//start the ajax
$.ajax({
//this is the php file that processes the data and send mail
url: "process.php",
//GET method is used
type: "GET",
//pass the data
data: data,
//Do not cache the page
cache: false,
//success
success: function (html) {
//if process.php returned 1/true (send mail success)
if (html==1) {
//hide the form
$('.form').fadeOut('slow');
//show the success message
$('.done').fadeIn('slow');
//if process.php returned 0/false (send mail failed)
} else alert('Sorry, unexpected error. Please try again later.');
}
});
//cancel the submit button default behaviours
return false;
});
});
</script>
and process.php as
<?php
//Retrieve form data.
//GET - user submitted data using AJAX
//POST - in case user does not support javascript, we'll use POST instead
$name = ($_GET['name']) ? $_GET['name'] : $_POST['name'];
$email = ($_GET['email']) ?$_GET['email'] : $_POST['email'];
$website = ($_GET['website']) ?$_GET['website'] : $_POST['website'];
$comment = ($_GET['comment']) ?$_GET['comment'] : $_POST['comment'];
//flag to indicate which method it uses. If POST set it to 1
if ($_POST) $post=1;
//Simple server side validation for POST data, of course, you should validate the email
if (!$name) $errors[count($errors)] = 'Please enter your name.';
if (!$email) $errors[count($errors)] = 'Please enter your email.';
if (!$comment) $errors[count($errors)] = 'Please enter your comment.';
//if the errors array is empty, send the mail / no errors found
if (!$errors) {
//recipient
$to = 'info#abc.com';
//sender
$from = $name . ' <' . $email . '>';
//subject and the html message
$subject = 'Comment from ' . $name;
$message = '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head></head>
<body>
<table>
<tr><td>Name</td><td>' . $name . '</td></tr>
<tr><td>Email</td><td>' . $email . '</td></tr>
<tr><td>Phone</td><td>' . $website . '</td></tr>
<tr><td>Comment</td><td>' . nl2br($comment) . '</td></tr>
</table>
</body>
</html>';
//send the mail
$result = sendmail($to, $subject, $message, $from);
//if POST was used, display the message straight away
if ($_POST) {
echo 'Thank you! We have received your message.';
//This one for ajax
//1 means success, 0 means failed
} else {
echo '1';
}
} else {
//display the errors message
for ($i=0; $i<count($errors); $i++) echo $errors[$i] . '<br/>';
echo 'Back';
exit;
}
//Simple mail function with HTML header
function sendmail($to, $subject, $message, $from) {
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= 'From: ' . $from . "\r\n";
$result = mail($to,$subject,$message,$headers);
if ($result) return 1;
else return 0;
}
?>
Any help in the end ? Thankyou

Please browse process.php?name=jone&email=john#example.com&website=www.blabla.com&comment=blablabla to know if the problem is in the server side script.

Related

How to integrate reCAPTCHA with a form

I can't work out how to add Google reCAPTCHA to this contact form. I have no problems adding on the front end but can't seem to apply to the server side.
<!-- Form -->
<div id="contact-form">
<form method="post" action="contact.php">
<div class="field">
<label>Name:</label>
<input type="text" name="name" class="text" />
</div>
<div class="field">
<label>Email: <span>*</span></label>
<input type="text" name="email" class="text" />
</div>
<div class="field">
<label>Message: <span>*</span></label>
<textarea name="message" class="text textarea" ></textarea>
</div>
<div class="field">
<input type="button" class="button light medium" id="send" value="Send Message"/>
</div>
<div class="field">
<input type="button" class="button gray medium" value="Reset!"/>
</div>
<div class="loading"></div>
</form>
</div>
PHP Server Side
<?php
//Retrieve form data.
//GET - user submitted data using AJAX
//POST - in case user does not support javascript, we'll use POST instead
$name = ($_GET['name']) ? $_GET['name'] : $_POST['name'];
$email = ($_GET['email']) ?$_GET['email'] : $_POST['email'];
$message = ($_GET['message']) ?$_GET['message'] : $_POST['message'];
//flag to indicate which method it uses. If POST set it to 1
if ($_POST) $post=1;
//Simple server side validation for POST data, of course, you should validate the email
if (!$name) $errors[count($errors)] = 'Please enter your name.';
if (!$email) $errors[count($errors)] = 'Please enter your email.';
if (!$message) $errors[count($errors)] = 'Please enter your message.';
//If the errors array is empty, send the mail
if (!$errors) {
// ====== Your mail here ====== //
$to = 'admin#mysite.com <admin#mysite.com>';
// Sender
$from = $name . ' <' . $email . '>';
//subject and the html message
$subject = 'Contact Message from the Byblos Group Website';
$message = '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head></head>
<body>
<table>
<tr><td>Name:</td><td>' . $name . '</td></tr>
<tr><td>Email:</td><td>' . $email . '</td></tr>
<tr><td>Message:</td><td>' . nl2br($message) . '</td></tr>
</table>
</body>
</html>';
// Send the mail
$result = sendmail($to, $subject, $message, $from);
//if POST was used, display the message straight away
if ($_POST) {
if ($result) echo 'Thank you! We have received your message.';
else echo 'Sorry, unexpected error. Please try again later';
//else if GET was used, return the boolean value so that
//ajax script can react accordingly
//1 means success, 0 means failed
} else {
echo $result;
}
// If the errors array has values
} else {}
// Simple mail function with HTML header
function sendmail($to, $subject, $message, $from) {
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= 'From: ' . $from . "\r\n";
$result = mail($to,$subject,$message,$headers);
if ($result) return 1;
else return 0;
}
?>
We are validating google reCAPTCHA like this
$fileContent = '';
if (isset($_REQUEST['g-recaptcha-response']) && !empty($_REQUEST['g-recaptcha-response'])) {
$fileContent = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=your_recaptcha_secret_key&response=". $_REQUEST['g-recaptcha-response']);
}
$jsonArray = json_decode($fileContent, true);
if (isset($jsonArray['success']) && $jsonArray['success']==true) {
// process your logic here
} else {
echo 'Invalid verification code, please try again!';
}
I'm actually using this self-made function to check if reCAPTCHA is valid on my website
function checkCaptcha($cResp) {
$captchaSecret = "yourSecret";
$captchaRequestUrl = 'https://www.google.com/recaptcha/api/siteverify?secret='.$captchaSecret.'&response='.$cResp;
$captchaResponse = #file_get_contents($captchaRequestUrl);
if (!$captchaResponse) {
return 2;
}
$captchaResponse = json_decode($captchaResponse);
$captchaSuccess = $captchaResponse->{'success'};
if (!$captchaSuccess) {
return 3;
}
return 1;
}
Then you can check like the following
if (checkCaptcha($_POST['g-recaptcha-response']) === 1) // success
if (checkCaptcha($_POST['g-recaptcha-response']) === 2) // no resp
if (checkCaptcha($_POST['g-recaptcha-response']) === 3) // fail

PHP email contact form displays error

Every time I attempt to submit this contact form I receive the following error message:
'Please enter your message.'
The name error message and email error message do not appear unless I leave them blank. I attempted specifying post in the HTML.
Here is the HTML:
<div class="col-md-8 animated fadeInLeft notransition">
<h1 class="smalltitle">
<span>Get in Touch</span>
</h1>
<form action="contact.php" method="post" name="MYFORM" id="MYFORM">
<input name="name" size="30" type="text" id="name" class="col-md-6 leftradius" placeholder="Your Name">
<input name="email" size="30" type="text" id="email" class="col-md-6 rightradius" placeholder="E-mail Address">
<textarea id="message" name="message" class="col-md-12 allradius" placeholder="Message" rows="9"></textarea>
<img src="contact/refresh.jpg" width="25" alt="" id="refresh"/><img src="contact/get_captcha.php" alt="" id="captcha"/>
<br/><input name="code" type="text" id="code" placeholder="Enter Captcha" class="top10">
<br/>
<input value="Send" type="submit" id="Send" class="btn btn-default btn-md">
</form>
</div>
Here is the PHP:
<?php
//Retrieve form data.
//GET - user submitted data using AJAX
//POST - in case user does not support javascript, we'll use POST instead
$name = ($_GET['name']) ? $_GET['name'] : $_POST['name'];
$email = ($_GET['email']) ?$_GET['email'] : $_POST['email'];
$comment = ($_GET['comment']) ?$_GET['comment'] : $_POST['comment'];
//flag to indicate which method it uses. If POST set it to 1
if ($_POST) $post=1;
//Simple server side validation for POST data, of course, you should validate the email
if (!$name) $errors[count($errors)] = 'Please enter your name.';
if (!$email) $errors[count($errors)] = 'Please enter your email.';
if (!$comment) $errors[count($errors)] = 'Please enter your message.';
//if the errors array is empty, send the mail
if (!$errors) {
//recipient - replace your email here
$to = 'faasdfsdfs#gmail.com';
//sender - from the form
$from = $name . ' <' . $email . '>';
//subject and the html message
$subject = 'Message from ' . $name;
$message = 'Name: ' . $name . '<br/><br/>
Email: ' . $email . '<br/><br/>
Message: ' . nl2br($comment) . '<br/>';
//send the mail
$result = sendmail($to, $subject, $message, $from);
//if POST was used, display the message straight away
if ($_POST) {
if ($result) echo 'Thank you! We have received your message.';
else echo 'Sorry, unexpected error. Please try again later';
//else if GET was used, return the boolean value so that
//ajax script can react accordingly
//1 means success, 0 means failed
} else {
echo $result;
}
//if the errors array has values
} else {
//display the errors message
for ($i=0; $i<count($errors); $i++) echo $errors[$i] . '<br/>';
echo 'Back';
exit;
}
//Simple mail function with HTML header
function sendmail($to, $subject, $message, $from) {
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= 'From: ' . $from . "\r\n";
$result = mail($to,$subject,$message,$headers);
if ($result) return 1;
else return 0;
}
In your HTML form you name your <input... field "message" but then when you are in PHP you try to get the value from `$_GET['comment'].
I think if you get those lined up I think it will solve your problem.
I can see 2 issues:
Receive $_GET['comment'] or $_POST['comment'] but next you're using $message var
Do not use if($_POST) because $_POST as a superglobal
is always setted.
I suggest use this for check if a POST have been sent
if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {}
or this in case you want to check is not empty
if ( !empty($_POST) ) {}
How to detect if $_POST is set?

Sending mail in PHP results in undefined index

I am trying to get my contact form on my site to operate correctly. I am getting undefined index in regards to the $name, $email, $thesubject, $message variables, respectively.
Could anyone tell me what I need to do to get the email to properly send?
HTML/Form:
<div class="alert success success-message">
<div class="close">×</div>
<p>Your message has been sent!</p>
</div>
<form class="clearfix" method="post" action="contact.php">
<div class="field">
<label>Name <span>*</span></label>
<input type="text" name="name" class="text" value="" />
</div>
<div class="field">
<label>Email <span>*</span></label>
<input type="email" name="email" class="text" value="" />
</div>
<div class="field field-last">
<label>Subject <span>*</span></label>
<input type="text" name="thesubject" class="text" value="" />
</div>
<textarea name="message" class="text"></textarea>
<button id="send" class="btn">Submit</button>
<div class="loading"></div>
</form>
</div>
PHP:
<?php
//Retrieve form data.
//GET - user submitted data using AJAX
//POST - in case user does not support javascript, we'll use POST instead
$name = ($_GET['name']) ? $_GET['name'] : $_POST['name'];
$email = ($_GET['email']) ?$_GET['email'] : $_POST['email'];
$thesubject = ($_GET['thesubject']) ?$_GET['thesubject'] : $_POST['thesubject'];
$message = ($_GET['message']) ?$_GET['message'] : $_POST['message'];
//flag to indicate which method it uses. If POST set it to 1
if ($_POST) $post=1;
//Simple server side validation for POST data, of course, you should validate the email
if (!$name) $errors[count($errors)] = 'Please enter your name.';
if (!$email) $errors[count($errors)] = 'Please enter your email.';
if (!$thesubject) $errors[count($errors)] = 'Please enter your subject.';
if (!$message) $errors[count($errors)] = 'Please enter your message.';
//if the errors array is empty, send the mail
if (!$errors) {
// ====== Your mail here ====== //
$to = 'myemail#gmail.com';
//sender
$from = $name . ' <' . $email . '>';
//subject and the html message
$subject = 'yourwebsite.com / ' . $thesubject . '';
$message = '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head></head>
<body>
<table>
<tr><td>Name:</td><td>' . $name . '</td></tr>
<tr><td>Email:</td><td>' . $email . '</td></tr>
<tr><td>Message:</td><td>' . nl2br($message) . '</td></tr>
</table>
</body>
</html>';
//send the mail
$result = sendmail($to, $subject, $message, $from);
//if POST was used, display the message straight away
if ($_POST) {
if ($result) echo 'Thank you! We have received your message.';
else echo 'Sorry, unexpected error. Please try again later';
//else if GET was used, return the boolean value so that
//ajax script can react accordingly
//1 means success, 0 means failed
} else {
echo $result;
}
//if the errors array has values
} else {}
//Simple mail function with HTML header
function sendmail($to, $subject, $message, $from) {
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= 'From: ' . $from . "\r\n";
$result = mail($to,$subject,$message,$headers);
if ($result) return 1;
else return 0;
}
?>
use isset function to check if variable is setup. For example:
$name = isset($_GET['name']) ? $_GET['name'] : $_GET['name'];

Form submit is not showing success message

I am having a problem with my contact form where there is no success indication being given, even though the message is successfully sent to email. The form appears broken to the user because the page is unchanged when the submit button is pressed. This page was built using a Themeforest template, but the author is unable to provide a solution. I was hoping that someone could point me in the right direction.
Here is the stock 'contact-send.php' file I was given:
<?php
$names = $_POST['names'];
$email = $_POST['email_address'];
$comment = $_POST['comment'];
$to ='to#email.com';
$message = "";
$message .= "*Name: " . htmlspecialchars($names, ENT_QUOTES) . "<br>\n";
$message .= "*Email: " . htmlspecialchars($email, ENT_QUOTES) . "<br>\n";
$message .= "*Comments: " . htmlspecialchars($comment, ENT_QUOTES) . "<br>\n";
$lowmsg = strtolower($message);
$headers = "MIME-Version: 1.0\r\nContent-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: \"" . $names . "\" <" . $email . ">\r\n";
$headers .= "Reply-To: " . $email . "\r\n";
$message = utf8_decode($message); mail($to, "Note from the Contact Form", $message, $headers);
if ($message){
echo 'sent';
}else{
echo 'failed';
}
?>
This is the stock html code:
<form id="contact-form" name="contact-form" action="" method="post">
<label class="contact-label">Name*</label>
<input class="contact-input" type="text" name="contact-names" value="" /><br /><span class="name-required"></span>
<label class="contact-label">Email*</label>
<input class="contact-input" type="text" name="contact-email" value="" /><br /><span class="email-required"></span>
<label class="contact-label">Message*</label>
<textarea name="comments" rows="2" cols="20" class="contact-commnent"></textarea><br /><span class="comment-required"></span>
<input type="submit" value="Send" id="submit-form" class="button lightred contact-submit" />
</form>
This file is attached to the html pages as well: (juery-contact.js)
$(document).ready(function(){
$('#submit-form').click(function(){
var reg = /^([A-Za-z0-9_\-\.])+\#([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
var names = $('#contact-form [name="contact-names"]').val();
var email_address = $('#contact-form [name="contact-email"]').val();
var comment = $.trim($('#contact-form .contact-commnent').val());
var data_html ='' ;
if(names == ""){
$('.name-required').html('Your name is required.');
}else{
$('.name-required').html('');
}
if(email_address == ""){
$('.email-required').html('Your email is required.');
}else if(reg.test(email_address) == false){
$('.email-required').html('Invalid Email Address.');
}else{
$('.email-required').html('');
}
if(comment == ""){
$('.comment-required').html('Comment is required.');
}else{
$('.comment-required').html('');
}
if(comment != "" && names != "" && reg.test(email_address) != false){
data_html = "names="+ names + "&comment=" + comment + "&email_address="+ email_address;
//alert(data_html);
$.ajax({
type: 'post',
url: 'contact-send.php',
data: data_html,
success: function(msg){
if (msg == 'sent'){
$('#success').html('Message sent!') ;
$('#contact-form [name="contact-names"]').val('');
$('#contact-form [name="contact-email"]').val('');
$('#contact-form .contact-commnent').val('');
}else{
$('#success').html('Mail Error. Please Try Again.!') ;
}
}
});
}
return false;
})
})
Here is the live site if you need it: http://shamrockmasonry.ca/contact.html
Any help would be appreciated!
I glanced at the source code and noticed that there isn't an element with '#success' id.
So this block of code that adds html message to #success element can't do that because that element does not actually exist:
if (msg == 'sent'){
$('#success').html('Message sent!');
$('#contact-form [name="contact-names"]').val('');
$('#contact-form [name="contact-email"]').val('');
$('#contact-form .contact-commnent').val('');
}else{
$('#success').html('Mail Error. Please Try Again.!') ;
}
To answer your additional question you made in the comments about removing the error messages you got after successful submit do the following.
Add additional class to your span's, like in example here
<span class="email-required error-message"></span>
<span class="name-required error-message"></span>
<span class="comment-required error-message"></span>
And add this line of code to your jquery block:
if (msg == 'sent'){
$('#success').html('Message sent!');
$('#contact-form [name="contact-names"]').val('');
$('#contact-form [name="contact-email"]').val('');
$('#contact-form .contact-commnent').val('');
$('.error-message').empty(); // clears all of the current error messages on success
}else{
$('#success').html('Mail Error. Please Try Again.!') ;
}
So add a div element with #success id above your form tag and you should be good.
Hope it helps.
Add <div id="success"></div> before form HTML
Should be:
<div id="success"></div>
<form id="contact-form" name="contact-form" action="" method="post">
[...]
</form>

Form Submission = AdWords Conversion

After an html form submission I need to record an AdWords conversion. The get_support.html calls contact.php. Here's the form portion of the code:
<form method="post" action="contact.php">
<div class="field">
<label>WHAT DO YOU NEED HELP WITH?: <span>*</span></label>
<textarea name="message" class="text textarea" ></textarea>
</div>
<div class="field">
<label>NAME: <span>*</span></label>
<input type="text" name="name" class="text" />
</div>
<div class="field">
<label>PHONE NUMBER: <span>*</span></label>
<input type="text" name="phone" class="text" />
</div>
<div class="field">
<label>EMAIL: <span>*</span></label>
<input type="text" name="email" class="text" />
</div>
<div class="field">
<input type="button" id="send" value="SUBMIT INFO" />
<div class="loading"></div>
</div>
</form>
Here's contact.php
<?php
//Retrieve form data.
//GET - user submitted data using AJAX
//POST - in case user does not support javascript, we'll use POST instead
$name = ($_GET['name']) ? $_GET['name'] : $_POST['name'];
$email = ($_GET['email']) ?$_GET['email'] : $_POST['email'];
$message = ($_GET['message']) ?$_GET['message'] : $_POST['message'];
//flag to indicate which method it uses. If POST set it to 1
if ($_POST) $post=1;
//Simple server side validation for POST data, of course, you should validate the email
if (!$name) $errors[count($errors)] = 'Please enter your telephone.';
if (!$email) $errors[count($errors)] = 'Please enter your email.';
if (!$message) $errors[count($errors)] = 'Please enter your message.';
//if the errors array is empty, send the mail
if (!$errors) {
// ====== Your mail here ====== //
$to = 'US TECH SUPPORT <ustechsupport#techsupportheroes.com>';
//sender
$from = $name . ' <' . $email . '>';
//subject and the html message
$subject = 'FORM-SUBMISSION-VIRUSREMOVALHEROES.COM';
$message = '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head></head>
<body>
<table>
<tr><td>Phone:</td><td>' . $name . '</td></tr>
<tr><td>Email:</td><td>' . $email . '</td></tr>
<tr><td>Message:</td><td>' . nl2br($message) . '</td></tr>
</table>
</body>
</html>';
//send the mail
$result = sendmail($to, $subject, $message, $from);
//if POST was used, display the message straight away
if ($_POST) {
if ($result) echo 'Help is on the way! We have received your message.';
else echo 'Sorry, unexpected error. Please try again later';
//else if GET was used, return the boolean value so that
//ajax script can react accordingly
//1 means success, 0 means failed
} else {
echo $result;
}
//if the errors array has values
} else {}
//Simple mail function with HTML header
function sendmail($to, $subject, $message, $from) {
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= 'From: ' . $from . "\r\n";
$result = mail($to,$subject,$message,$headers);
if ($result) return 1;
else return 0;
}
?>
And the conversion code from Google for my Form Fill
echo '<!-- Google Code for Form Submission Conversion Page -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 1004137309;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "H1HvCNOWswQQ3dbn3gM";
var google_conversion_value = 0;
/* ]]> */
</script>
<script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion.js&quot;&gt;
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="http://www.googleadservices.com/pagead/conversion/1004137309/?value=0&amp;amp;label=H1HvCNOWswQQ3dbn3gM&amp;amp;guid=ON&amp;amp;script=0&quot;/&gt;
</div>
</noscript>';
I have researched this and just cannot figure out how to solve the problem. Any help is appreciated.
Google Adwords conversion code works by placing the conversion tracking code on the "Thank You" page. Once your form is submitted, lead the user to a Thank You page. Place your conversion tracking code in the source of this page and you will start registering conversions. As the only logical way of users reaching this page is by submitting a duly filled contact form.
Also, make sure there is no other way to get to this page except by submitting the form (using robots and de-linking from every other page on-site)

Categories