Hey all am building an e-commerce site for Uni and need to do a contact form. I have done one but i just get an error when i submit the form so was wondering if anyone could help me out 😉
Heres what i have
One page called contact.php which contains the following code;
<!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 content="text/html; charset=utf-8" http-equiv="Content-Type" />
<link rel="stylesheet" type="text/css" href="style.css"/>
<title>Contact Form</title>
</head>
<body>
<div id="page">
<img src="images/banner1.jpg" alt="banner"/>
<div id="navi-container">
<ul id="navi">
<li><a href="index.php">Home</a></li>
<li><a href="cars.php">Cars</a></li>
<li><a href="interior.php">Interior</a></li>
<li><a href="exterior.php">Exterior</a></li>
<li><a href="gallery.php">Gallery</a></li>
<li><a href="checkout.php">Checkout</a></li>
<li><a href="contactus.php">Contact Us</a></li>
</ul>
</div>
<div id="content">
<table width="400" border="0" align="center" cellpadding="3" cellspacing="1">
<tr>
<td><strong>Contact Form </strong></td>
</tr>
</table>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td><form name="form1" method="post" action="send_contact.php">
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr>
<td width="16%">Subject</td>
<td width="2%">:</td>
<td width="82%"><input name="subject" type="text" id="subject" size="50"/></td>
</tr>
<tr>
<td>Detail</td>
<td>:</td>
<td><textarea name="detail" cols="50" rows="4" id="detail"></textarea></td>
</tr>
<tr>
<td>Name</td>
<td>:</td>
<td><input name="name" type="text" id="name" size="50"/></td>
</tr>
<tr>
<td>Email</td>
<td>:</td>
<td><input name="customer_mail" type="text" id="customer_mail" size="50"/></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="Submit" value="Submit"/> <input type="reset" name="Submit2" value="Reset"/></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body>
</html>
the second page i have is
send_contact.php
<!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 content="text/html; charset=utf-8" http-equiv="Content-Type" />
<link rel="stylesheet" type="text/css" href="style.css"/>
<title>Home</title>
</head>
<body>
<div id="page">
<img src="images/banner1.jpg" alt="banner"/>
<div id="navi-container">
<ul id="navi">
<li><a href="index.php">Home</a></li>
<li><a href="cars.php">Cars</a></li>
<li><a href="interior.php">Interior</a></li>
<li><a href="exterior.php">Exterior</a></li>
<li><a href="gallery.php">Gallery</a></li>
<li><a href="checkout.php">Checkout</a></li>
<li><a href="contactus.php">Contact Us</a></li>
</ul>
</div>
<div id="content">
<?php
$subject ="$subject";
$message="$detail";
$mail_from="$customer_mail";
$header="from: $name <$mail_from>";
$to ='';
$send_contact=mail($to,$subject,$message,$header);
if($send_contact){
echo "We've recived your contact information";
}
else {
echo "ERROR";
}
?>
</div>
</div>
</body>
</html>
Obviously the email field does have an email in but when i submit the form i just get a blank page called error 🙁
would appreciate it if someone could help me out please 🙂