Hi How are you? after your instructions my form was working just fine, showing the ThankYou page correctly, but recently stopped working again.... Could you please check it out?
Also I started to use a CRM platform and I would like to add the new contacts to that system, they gave me the source code example to do it but since this form is not working properly since the beginning I prefer to check it with you guys.
The source code they gave is this:
Contact Form
Contact form & Landings
SUGGEST EDITS
STEP 1: Create the form in HTML
HTML
<div id="landingForm">
<div class="titulo2">CONTACTO</div>
<div><label>Name:</label><input type="text" id="name"/></div>
<div><label>Phone:</label><input type="text" id="phone"/></div>
<div><label>Cellphone:</label><input type="text" id="cellphone"/></div>
<div><label>Email:</label><input type="text" id="email"/></div>
<div><label>Message:</label><textarea id="message"></textarea></div>
<input type="button" onclick="send()" value="SEND"></div>
</div>
STEP 2: Javascript Send () function
JavaScript
<script>
function validate_mail(mail){
var filter = /[\w-.]{1,}@([\w-]{1,}.)*([\w-]{1,}.)[\w-]{2,4}/;
return filter.test(mail)
}
function send(){
if(validate_mail($("#email").val())){
data = { 'name':$("#name").val(),
'email':$("#email").val(),
'phone': $("#phone").val(),
'cellphone': $("#cellphone").val(),
'message': $("#message").val()
}
jqxhr = $.ajax({'url':"./sendContact.php", 'type': "POST", 'data':data })
.done(function(){
$("#landingForm").html("<span>Success</span>")
});
}
}
</script>
This function sends contact data to sendContact.php by ajax when user clicks SUBMIT form button
STEP 3: Create sendContact.php
Copy paste this code and change the TokkoAuth with your actual state APIKEY
PHP
<?php
include 'api.inc';
//CHANGE THIS APIKEY WITH YOUR REAL STATE APIKEY
$auth = new TokkoAuth('5940ea45eb7cfb55228bec0b958ea9c0be151757');
$data = array(
'text' => $_REQUEST['message'] ,
'name' => $_REQUEST['name'],
'email' => $_REQUEST['email'],
'cellphone' => $_REQUEST['cellphone'],
'phone' => $_REQUEST['phone'],
'tags' => array('mysite.com','my first landing','google'),
);
//Send Tokko property ID as 'property' if you wish send a specific property
if ($_REQUEST['property']){
$data['properties'] = array($_REQUEST['property']);
}
//Send Tokko development ID as 'development' if you wish send a development
if($_REQUEST['development']){
$data['developments'] = array($_REQUEST['development']);
}
$webcontact = new TokkoWebContact($auth, $data);
$response = $webcontact->send();
?>