What is wrong with my form code?! First form not working.
This is the code for the html side of the form on my home page (sorry its not colored like in dreamweaver). It appears that when I click submit it knows to go to the php file, and then
it refreshed the page like its suppose to. But everytime I check my email there is nothing
in there.
I have the correct email address in so it seems I must be missing something else in my code.
<form id="form" name="form.php" method="post" action="form.php">
<td width="70" height="34" bgcolor="#EEDB36"><label for="textfield3">
<p class="formtextstyle"> <span class="formtextsmall">Full Name</span></p>
</label></td>
<td width="161" bgcolor="#EEDB36"><input type="text" name="name" id="textfield2" /></td>
</tr>
<tr>
<td bgcolor="#EEDB36"> </td>
<td height="34" bgcolor="#EEDB36"><label for="Email" class="formtextstyle"><span class="formtextsmall">Email</span></label></td>
<td bgcolor="#EEDB36"><input type="text" name="Email" id="Email" /></td>
</tr>
<tr>
<td bgcolor="#EEDB36"> </td>
<td height="33" bgcolor="#EEDB36"><label for="Phone" class="formtextstyle"><span class="formtextsmall">Phone</span></label></td>
<td bgcolor="#EEDB36"><input type="text" name="Phone" id="Phone" /></td>
</tr>
<tr>
<td bgcolor="#EEDB36"> </td>
<td height="89" bgcolor="#EEDB36"><label for="textarea" class="formtextstyle"><span class="formtextsmall">Short Description of Problem</span></label></td>
<td bgcolor="#EEDB36"><textarea name="textarea" id="textarea" cols="15" rows="5"></textarea></td>
</tr>
<tr>
<td> </td>
<td height="88"> </td>
<td><input type="submit" name="button" id="button" value="send" /></form></td>
Then this is my php script which I named "form.php"
<?php
/* Email Variables */
$emailSubject = 'form';
$webMaster = 'rcece1@yahoo.com';
/* Data Variables */
$email = $_POST['email'];
$name = $_POST['name'];
$phone = $_POST['phone'];
$body = <<<EOD
<br><hr><br>
Name: $name <br>
Email: $email <br>
Comments: $phone <br>
EOD;
$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body,
$headers);
/* Results rendered as HTML */
$theResults = <<<EOD
<html>
<head>
<title>sent message</title>
<meta http-equiv="refresh" content="3;URL=http://www.allcountywaterproofing.com">
<style type="text/css">
<!--
body {
background-color: #444;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 20px;
font-style: normal;
line-height: normal;
font-weight: normal;
color: #fec001;
text-decoration: none;
padding-top: 200px;
margin-left: 150px;
width: 800px;
}
-->
</style>
</head>
<div align="center">Your email will be answered soon as possible!
You will return to All County Waterproofing now!</div>
</div>
</body>
</html>
EOD;
echo "$theResults";
?>
My home page is located at All County Waterproofing
I also have no idea why the top box of the form is showing the way it is. At some point it was where it was suppose to be, then I tried to make the form work by changing code around and it seems I'm just making things worse.
If anyone is able to tell what I am doing wrong you would save me so much time and I'd really be indebted to you forever. I have never wasted so much time on a form before I'm really losing my mind.
=[
|~| VeeroTech Hosting - sales @ veerotech.net
|~| High Performance CloudLinux & LiteSpeed Powered Web Hosting
|~| cPanel & WHM - Softaculous - Website Builder - R1Soft - SpamExperts
|~| Visit us @veerotech Facebook - Twitter - LinkedIn