Hi,
Im trying to submit the email through the online contact page http://www.origin-designs.co.uk/. I cannot receive emails through it, im not sure where is the problem with the code. It seems to be working fine for other people through fiddle or some other tool. I’m providing the code for the form too. any feedback welcome, cheers
PHP code: [php]<?php
$error = false;
$sent = false;
if(isset($_Post['name'])) {
if(empty($_Post['name']) || empty($_Post['email']) || empty($_Post['comments'])) {
$error = true;
} else {
$to = "[email protected]";
$name = trim($_Post['name']);
$email = trim($_Post['email']);
$comments = trim($_Post['comments']);
$subject = "Contact Form";
$messages = "Name: $name \r\n Email: $email \r\n Comments: $comments";
$headers = "From:" . $name;
$mailsent = mail($to, $subject, $messages, $headers);
if($mailsent) {
$sent = true;
}
}
}
?>[/php]
HTML: <?php if($error == true) { ?>
<p class="error"></p>
<?php } if($sent == true) { ?>
<p class="sent"></p>
<?php } ?>
<div id="form">
<form name="contact" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"], ENT_QUOTES, "utf-8"); ?>" method="post">
<fieldset>
<h4>Contact Me!</h4>
<label for="name">Name:</label>
<input type="text" name="name" id="name"/>
<label for="email"/>Email:</label>
<input type="text" name="email" id="email"/>
<label for="comments" id="comments">Comments:</label>
<textarea name="comments" id="" width="90%"></textarea>
<fieldset>
<input class="btn" type="submit" name="submit" class="submit" value="Send email"/>
<input class="btn" type="reset" value="Reset"/>
</fieldset>
</fieldset>
</form>
Many thanks