PDA

View Full Version : How to customize contact form?


AdrianSmithUK
01-25-2010, 02:47 PM
Does anybody know how to add extra fields to the contact form.

EG:

First Name
Last Name
Company
Address 1
etc ...

KID_1194
03-06-2011, 03:08 PM
I'm also looking forward to know how to do it ..!

someone help plz ..!

Frost5
03-06-2011, 03:57 PM
Your probably better off making your own contact form if your not familiar with a lot of editing for php. There are a lot of simple forms that you can create quickly.

<?php

// Subject and e-mail variables

$emailSubject = 'Whatever Subject you want';
$webMaster = 'Your E-mail';

// Variables that you want included in e-mail

$emailField = $_POST['email'];


$body = <<<EOD
<br><hr><br>
Email: $emailField


$headers = "From: $emailField \r\n";
$headers .= "Content=type: text/html\r\n";

if (!(mail($webMaster, $emailSubject, $body, $headers)))
{
echo "Mail error...Please try again later!";
die();
}

// results rendered as html

$theResults = <<<EOD
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Confirmation</title>

</head>
// Confirmation Page
<body>
<p align="center">Thank you!
</p>
<p align="center">We have received your application, you will be contacted within a few days.</p>
<p align="center">&nbsp;</p>
<p align="center"><a href="forum.php">Forums</a></p>
</body>
</html>
EOD;
echo "$theResults";
?>


Not the best, but it should get you on the right track.

tonyvh2
03-09-2011, 12:24 PM
you need to edit the file sendmessage.php as well as the "contactus" template,

I used another form script like Frost5 suggested, but I did that because I wanted to have two contact possibilities, one for forum-related issues and one for other reasons to contact.

When you are gonna use another formmail script I would really check if it is completely secure/spam-free without possibilty to inject mail headers etc