PDA

View Full Version : Help with email contact form please.



webdevnoob
25 Apr 2010, 04:34 PM
Hello. I have started to create a website for my business using the shapeshifter template from themeforest.

I have created nearly the entirety of my site with no trouble but I can't get the dang email contact form to work.

Here is the HTML:


<form action="../library/scripts/send.php" method="post">
<p>Your Name (required)<br />
<span><input type="text" id="name" name="name" value="" size="40" /></span> </p>
<p>Your Email (required)<br />
<span><input type="text" id="email" name="email" value=""size="40" /></span> </p>
<p>Subject<br />
<span><input type="text" id="subject" name="subject" value="" size="40" /></span> </p>
<p>Your Message<br />
<textarea name="message" cols="40" id="message"></textarea>
</p>

<p><input class="button" type="submit" value="Send" /></p>
</form>

</div>

and here is the PHP:


<?php

//****************************************
$to = 'test@bigriverfilms.co.uk'; //edit here
//****************************************

$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];

mail($to, 'Website Form Request', ' name: '.$name.' email: '.$email.' subject: '.$subject.' enquiry: '.$message);
header("Location: ".@$_SERVER['HTTP_REFERER'].'#sent');
?>
When testing the form I do not recieve an email in my inbox. Probably really obvious but can anyone tell me where I am going wrong?

Thanks!

Trillium
26 Apr 2010, 12:54 PM
Well, are you testing locally? Because if you are, I think that you need a mail server to actually be able to send the mail.

Also, you might try:

mail($email, $message, $subject);
instead of:

mail($to, 'Website Form Request', ' name: '.$name.' email: '.$email.' subject: '.$subject.' enquiry: '.$message);