Contact Form

Is the new site running on Joomla like the old site?

Also, if you dislike having to write any code at all, there are companies that provide hosted-forms (SaaS companies). Also, Joomla/WordPress/CMS-of-some-sort should have at least 10 different forms to choose from.

Lastly, try shrinking the donkey logo on the left to be about the same size as the text. I find it a bit difficult to scroll through your site with the black banner taking up so much space. (alternatively, you could shrink the donkey about 25% and increase the font to be a similar size as the logo).
 
<form> - remove
<form method="post" action="contactengine.php">
<input type="text" class="col-md-6 col-xs-12 name" name='name' placeholder='Name'/> - change to 'Name' - to match the php POST
<input type="text" class="col-md-6 col-xs-12 Email" name='Email' placeholder='Email'/>
<input type="text" class="col-md-6 col-xs-12 Tel" name='Tel' placeholder='Phone Number'/> - Add this line for telephone number, as per $_POST['Tel'] ?
<input type="text" class="col-md-12 col-xs-12 Subject" name='Subject' placeholder='Subject'/>
<textarea type="text" class="col-md-12 col-xs-12 Message" name='Message' placeholder='Message'></textarea>
<div class="cBtn col-xs-12">
<ul>
<input type="submit" name="submit" value="Submit" class="submit-button" />
</ul>
</div>
</form>

You're testing the code online (live) ?
Host server has PHP installed (generally it will) ?

Also check spam folder if still not working.
 
Last edited:
// prepare email body text - a few changes to your prepare email section
$header = 'A client has filled out the contact form, see details below' . "\n" . '---------------------------------------------------' . "\n";
$dets = 'Name: ' . $Name . "\n";
$dets1 = 'Telephone number: ' . $Tel . "\n";
$dets2 = 'Email Address: ' . $Email. "\n";
$dets3 = 'Subject: ' . $Subject . "\n";
$dets4 = 'Message: ' . $Message . "\n";
$messagey = $header . $dets . $dets1 . $dets2 . $dets3 . $dets4;

//Changes the reply to email so the you can easily reply
$headers = 'From: ' . $_POST["Email"] . "\r\n" .
'Reply-To: ' . $_POST["Email"] . "\r\n" .
'X-Mailer: PHP/' . phpversion();

// send email
$success = mail("$EmailTo", "$Subject", $messagey, "$headers");

// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.php\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>

A few changes I would make to contactengine.php
 
If all else fails, try this:

1. Download the phpmailer file at the following link, extract it from the zip file and upload it to your server. https://www.dropbox.com/s/sahy6vqbi0segsb/phpmailer.zip (Upload it into the same folder as the contactengine.php page, or change the location to this file in the script below)

2. On your contactengine.php page, add the following code: (Replace the bold / uppercase fields)

Code:
<?php
if ((isset($_POST['Name'])) && (strlen(trim($_POST['Name'])) > 0)) {
	$Name = stripslashes(strip_tags($_POST['Name']));
} else {$Name = 'No name entered';}
if ((isset($_POST['Tel'])) && (strlen(trim($_POST['Tel'])) > 0)) {
	$Tel = stripslashes(strip_tags($_POST['Tel']));
} else {$Tel = 'No Phone Number Entered';}
if ((isset($_POST['Email'])) && (strlen(trim($_POST['Email'])) > 0)) {
	$Email = stripslashes(strip_tags($_POST['Email']));
} else {$Email = 'No e-Mail Address Entered';}
if ((isset($_POST['Subject'])) && (strlen(trim($_POST['Subject'])) > 0)) {
	$Subject = stripslashes(strip_tags($_POST['Subject']));
} else {$Subject = 'No Subject Entered';}
if ((isset($_POST['Message'])) && (strlen(trim($_POST['Message'])) > 0)) {
	$Message = stripslashes(strip_tags($_POST['Message']));
} else {$Message = 'No Message Entered';}
ob_start();
?>

<b>Name</b>:    

<?=$Name;?>
<br><br>

<b>Telephone</b>:    

<?=$Tel;?>
<br><br>

<b>E-mail</b>: 
   
<?=$Email;?>
<br><br>

<b>Subject</b>: 
   
<?=$Subject;?>
<br><br>

<b>Message</b>:    

<?=$Message;?>
<br><br>

<?
$body = ob_get_contents();

$to = '[email protected]';
$email = '[email protected]';
$fromaddress = "[email protected]";
$fromname = "[B]YOUR FROM NAME[/B]";

require("phpmailer.php");

$mail = new PHPMailer();

$mail->From     = "[email protected]";
$mail->FromName = "[B]YOUR FROM TITLE[/B]";
$mail->AddAddress("[B]YOUR EMAIL ADDRESS[/B]","Your Name ");      //change to your email address

$mail->WordWrap = 50;
$mail->IsHTML(true);

$mail->Subject  =  "[B]YOUR SUBJECT[/B]";
$mail->Body     =  $body;
$mail->AltBody  =  $body;

if(!$mail->Send()) {
	$recipient = '[B]YOUR EMAIL ADDRESS[/B]';    //change to your email address
	$subject = 'Contact form failed';
	$content = $body;	
  mail($recipient, $subject, $content, "From: [email][email protected][/email]\r\nReply-To: $email\r\nX-Mailer: DT_formmail");
  exit;
}
?>

See if this works for you and I will help you.
 
Last edited:
Grave you are the best. Thanks for your help. It is working. If there is anything I can do for you let me know.
 
No problem man :)

I'll let you know when my liver fails or something :p

1 thing tho, I just looked at the site; because of the additional contact form entry (Telephone number) things have become a little misaligned.
A simple fix would be to do the following changes in 'style.css'.

Somewhere around line 1235 in style.css
-----------------------------------------------

Add the following above the '.subject' rule:

.Tel{
margin-bottom:10px;
margin-right: 10px;
width:403px;
}


replace '.Subject' with the following:

.Subject{
margin-bottom:10px;
width: 403px;
}


-----------------------------------------------

Somewhere around line 236 in style.css
-----------------------------------------------

Also add the following code into the '@media screen and (max-width: 1229px)' rule-set, after the '.name' entry:

.Tel{
width: 100% !important;
}
.Subject{
width: 100% !important;
}


-----------------------------------------------

And that should make the form look a little neater.

Good luck :)
 
Last edited:
Top
Sign up to the MyBroadband newsletter
X