Ok. I need to make an email form for on a website and I coded it into my website but now it doesn't work link Click on contacts, it doesn't seem to work.
Heres my code:
This is my first time ever using php
Heres my code:
HTML:
<!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>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Cycles in the City | Contact</title>
<meta name="keywords" content="harley, davidson, harley davidson, detoit, motorcycles, biker, bikes, biker bob's, biker bobs, taylor, michigan, detroit, motown, events, hogs, HOGS, hog, HOG, HD" />
<meta name="description" content="Cycles in the City is hosted by Biker Bob's Harley Davidson Motown and Susan G. Komen for the Cure. It's in the heart of downtown Detroit." />
<link href="style_2.css" rel="stylesheet" type="text/css" media="screen" />
<?php
// get posted data into local variables
$EmailFrom = Trim(stripslashes($_POST['EmailFrom']));
$EmailTo = "abetancourt@bikerbobshd.com";
$Subject = "Cycles in the City info";
$Name = Trim(stripslashes($_POST['Name']));
$Address = Trim(stripslashes($_POST['Address']));
$Telephone = Trim(stripslashes($_POST['Telephone']));
// validation
$validationOK=true;
if (Trim($EmailFrom)=="") $validationOK=false;
if (Trim($Name)=="") $validationOK=false;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Address: ";
$Body .= $Address;
$Body .= "\n";
$Body .= "Telephone: ";
$Body .= $Telephone;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=ok.htm\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>
</head>
<body>
<!-- start header -->
<div id="header">
<div id="menu">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="bands.html">Music</a></li>
<li><a href="sponsors.html">Sponsors</a></li>
<li><a href="map.html">Map</a></li>
<li class="current_page_item"><a href="contact.html">Contact</a></li>
</ul>
</div>
</div>
<div id="logo">
</div>
<!-- end header -->
<hr />
<!-- start page -->
<div id="page">
<!-- start content -->
<div id="sponsors">
<div class="post_sponsors">
<form method="POST" action="contact.php">
Fields marked * are required
<p>Email From:* <br>
<input type="text" name="EmailFrom">
<p>Name:* <br>
<input type="text" name="Name">
<p>Address:<br>
<input type="text" name="Address">
<p>Telephone:<br>
<input type="text" name="Telephone">
<p><input type="submit" name="submit" value="Submit">
</form>
<p>
</div>
</div>
</div>
<!-- end page -->
<hr />
<!-- start footer -->
<div id="footer">
<p>©2009 All Rights Reserved. • Cycles in the City.</p>
</div>
<!-- end footer -->
</body>
</html>
This is my first time ever using php