I am building a pretty simple contact form and can't get it to send the email for some reason.
I have created many forms with this exact same code but this time have added allot more fields and checkboxes.. It has always worked before but this is the first time I have used divs to hold all of my content. before I used tables.
Anywho.. if any of you could take a lookie and let me know if I am missing something here is my code:
Code: Select all
<body>
<?
// your name
$recipientname = "";
// your email
$recipientemail = "email goes here"
// subject of the email sent to you
$subject = " ";
// thankyou displayed after the user clicks "submit"
$submitmessage = "<div style='position:relative; left:0px; '>Thank You For Your Message, Please allow us 24 hours to respond</div>";
?>
<?
if($submitform) {
// check required fields
$dcheck = explode(",",$require);
while(list($check) = each($dcheck)) {
if(!$$dcheck[$check]) {
$error .= "Missing $dcheck[$check]<br>";
}
}
// check email address
if( !eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*"
."@([a-z0-9]+([\.-][a-z0-9]{1,})+)*$",
$Email, $regs) )
{
$error .= "'$Email' isn't a valid mail address!<BR>";
}
elseif( gethostbyname($regs[2]) == $regs[2] )
{
$error .= "Error: Can't find the host '$regs[2]'!<br>";
}
// display errors
if($error) {
?>
<b>Error</b><br>
<? echo $error; ?><br>
<a href="index.php?c=contact" onClick="history.go(-1)">try again</a><BR><BR>
<?
}else{
// format message
$message = "Response for $recipientname:
Name:
$Name
";
// send mail and print success message
mail("$recipientemail","$subject","$message","From: $Name");
echo "$submitmessage";
}
}
if(!$submitform) {
?>
<form name="contactform" action="contact_page.php" method="post">
<input type="hidden" name="require" value="Name,Email">
<div style=" width:520px; height:648px; z-index:9;">
<div style=" position:relative; left: 16px;"><img src="images/FormBackGround.jpg" border="0"></div>
<div style="position:absolute; top: 83px; left: 108px;"><img src="images/brokerData.jpg"></div>
<div style="position:absolute; width: 200px; top: 115px; left: 110px;">Broker Name:<br>
<input name="Name" size="30"></div>
<div style="position:absolute; width: 200px; top: 158px; left: 110px;">Title / Owner:<br>
<input name="Title" size="30"></div>
<div style="position:absolute; width: 200px; top: 201px; left: 110px;">Company Name:<br>
<input name="Company" size="30"></div>
<div style="position:absolute; width: 200px; top: 244px; left: 110px;">Mailing Address:<br>
<input name="Mailing_Address" size="30"></div>
<div style="position:absolute; width: 200px; left: 345px; top: 116px;">Tel:<br>
<input name="Telephone" size="30"></div>
<div style="position:absolute; width: 200px; left: 345px; top: 158px;">Fax:<br>
<input name="Fax" size="30"></div>
<div style="position:absolute; width: 200px; left: 345px; top: 201px;">Email:<br>
<input name="Email" size="30"></div>
<div style="position:absolute; top: 297px; left: 110px;">Check boxes, if more than one if it applies</div>
<div style="position:absolute; top: 328px; width: 253px; left: 110px;">Licensed Mortgage Broker Y
<input name="Licensed_Mortgage_Broker_Y" type="checkbox" value=""> N<input name="Licensed_Mortgage_Broker_N" type="checkbox" value=""></div>
<div style="position:absolute; top: 359px; width: 253px; left: 110px;">Licensed Real Estate Agent Y
<input name="Licensed_Real_Estate_Agent_Y" type="checkbox" value=""> N<input name="Licensed_Real_Estate_Agent_N" type="checkbox" value=""></div>
<div style="position:absolute; top: 390px; width: 265px; left: 110px;">Licensed Real Estate Broker Y
<input name="Licensed_Real_Estate_Broker_Y" type="checkbox" value=""> N<input name="Licensed_Real_Estate_Broker_N" type="checkbox" value=""></div>
<div style="position:absolute; top: 421px; width: 254px; left: 110px;">
<input name="Accountant" type="checkbox" value=""> Accountant</div>
<div style="position:absolute; top: 452px; width: 254px; left: 110px;">
<input name="Lawyer" type="checkbox" value=""> Lawyer</div>
<div style="position:absolute; top: 481px; width: 254px; left: 110px;">
<input name="Consultant" type="checkbox" value=""> Consultant</div>
<div style="position:absolute; top: 512px; width: 254px; left: 110px;">
<input name="Business_Broker" type="checkbox" value=""> Business Broker</div>
<div style="position:absolute; top: 543px; width: 254px; left: 110px;">Other relevant licenses / Certifications?<br>
<input name="Other_Licenses" type="text" size="30"></div>
<div style="position:absolute; top: 596px; width: 412px; left: 110px;">How would you like to receive the referral commission agreement?</div>
<div style="position:absolute; top: 617px; width: 254px; left: 110px;">Fax<input name="Prefered_Fax" type="checkbox" value="">Email<input name="Prefered_Email" type="checkbox" value="">Mail<input name="Prefered_Mail" type="checkbox" value=""></div>
<div style="position:absolute; z-index:10; left: 82px; top: 654px;">
<input type="image" id="submit" src="images/Send.jpg" value="Submit" name="submitform"></div>
</div>
<? }
?>
</form>
</body>