Jump to content

contact form error


jesushax

Recommended Posts

Hi here is my code for my contact form

 

could anyone tell me if there is a problem here cos the emails arent sending :S

 

Cheers

 

<?php include($_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'); ?>

<div id="subs">
<div id="subs-text">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nullam mollis scelerisque mi.</div>
<div id="subs-image"><img src="/images/layout/front/1.png" alt="Home Image" /></div>
</div>
<div id="backlinks"><?php include($_SERVER['DOCUMENT_ROOT'] . '/includes/backlinks.php'); ?></div>

<div id="content">
<div id="content-left">
<h3>Contact Us</h3>
<?php
switch(@$_GET["action"]) {

case "send":

$name = $_POST["txtName"];
$email = $_POST["txtEmail"];
$tel = $_POST["txtTel"];
$details = $_POST["txtDetails"];

$to = $contactemail;
$subject = "Contact Form";
$message = "
<html>
<head>
<title>HTML email</title>
</head>
<body>
<table>
  <tr>
    <td>Name:</td>
    <td>$name</td>
  </tr>
  <tr>
    <td>Email:</td>
    <td>$email</td>
  </tr>
  <tr>
    <td>Tel:</td>
    <td>$tel</td>
  </tr>
  <tr>
    <td style=\"vertical-align:top\">Details:</td>
    <td>$details</td>
  </tr>
</table>
</body>
</html>
";// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";// More headers
$headers .= 'From: [email protected]' . "\r\n";
mail($to,$subject,$message,$headers);

echo '<p>your message</p>';
echo '<p>';
echo $message;
echo '</p>';
echo '<p>Has been sent and one of your friendly team will get back to you as soon as possible.</p>';

break;

default:
?>

<form method="post" id="contact" action="?action=send">
<table>
  <tr>
    <td>Name:</td>
    <td><input name="txtName" type="text" id="txtName" size="50" /></td>
  </tr>
  <tr>
    <td>Email:</td>
    <td><input name="txtEmail" type="text" id="txtEmail" size="50" /></td>
  </tr>
  <tr>
    <td>Tel:</td>
    <td><input name="txtTel" type="text" id="txtTel" size="20" /></td>
  </tr>
  <tr>
    <td style="vertical-align:top">Details:</td>
    <td><textarea name="txtDetails" id="txtDetails" cols="35" rows="7"></textarea></td>
  </tr>
  <tr>
    <td> </td>
    <td><input type="submit" name="Submit" id="Submit" value="Submit" /></td>
  </tr>
</table>
</form>
<?php 
break;
}
?>
</div>
<div id="content-right">
</div>
<?php 
include($_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php');
?>

Link to comment
https://forums.phpfreaks.com/topic/102471-contact-form-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.