Hi all,
I know this question has been asked in the past, but knowing how technology and techniques move on thought that the answers may be different.
I want to create a nice loking contact form, the information I need it to contain id:
Name:_____________________
Email Address:_____________________
Contact Number:_____________________
Date:_____________________
Message:_____________________
I've looked at the company that host my site and they have the following code:
<?php
$EmailFrom = "info@yourdomain.co.uk";
$EmailTo = "info@yourdomain.co.uk";
$Subject = "online form";
$Name = Trim(stripslashes($_POST['Name']));
$Email = Trim(stripslashes($_POST['Email']));
$Tel = Trim(stripslashes($_POST['Tel']));
$Message = Trim(stripslashes($_POST['Message']));
// validation
$validationOK=true;
if (!$validationOK) {
echo "please check your details";
header("Location: http://yourdommain.co.uk/contact.php");
exit;
}
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Tel: ";
$Body .= $Tel;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"1;URL=index.php\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"1;URL=index.php\">";
}
?>
What I'm not 100% on is designing the form in Dreamweaver and then tying the form in with the php file and getting the information emailed back to me. I did try downloading one from the net but just kept getting an error message so decided to try a different approach.
Any help would be grestly appreciated.
Many thanks
Nick
I don't think your host's script is adequate.
Ideally, you want a form processing script that validates fields, hides your email address and stops spam from every reaching you. FormM@ailer.php from DB Masters does all this and more. http://www.dbmasters.net/node/18 See their tutorial for further details.
Nancy O.
Nick,
FormM@ailer.php works for me. Try this link: http://tinyurl.com/btmytf6
OR
FormToEmail.com (free & pro versions available)
http://formtoemail.com/formtoemail_pro_version.php
Tectite
http://www.tectite.com/formmailpage.php
Forms to Go from Bebosoft (script generating software)
http://www.bebosoft.com/products/formstogo/overview/
Wufoo.com (on-line form service)
Nancy O.
NeoGen Hawk wrote:
I need to be able to adapt and blend in to my page
Hi again Nick -
I just wanted to be sure you realize that these mail processing scripts have zero effect on the look of the form displayed on your HTML page. They simply sit, hidden on your server, and handle the email process.
Every contact form has 3 parts:
Most scripts come with a basic, generic form to help you understand how to set it up. You can style the form any way you wish.
Nancy O.
Hi Ken,
Many thanks for your reply, I am aware of this yes, the problem I was having is when I used a third party form mailer on my pasge it moved things about and I couldn't correct the problem, I have since found one that I could modify and adapt to my needs http://www.nick-lawrence.co.uk/contact_us.html let me know if you see any problems with it?
Many thanks
Nick
Hi Nancy,
I managed to find one that works for me without changing the look and feel of my website, http://www.nick-lawrence.co.uk/contact_us.html let me know if you see any problems with it?
Many thanks for all your help and advice.
Regards
Nick
For best cross browser results, you should fix your code errors.
In HTML5 doc type, you need to be more disciplined with your code.
http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fwww.nick-lawr ence.co.uk%2Fcontact_us.html
Nancy O.
North America
Europe, Middle East and Africa
Asia Pacific