What's wrong with my mailer.php?

Soldato
Joined
1 Sep 2005
Posts
10,001
Location
Scottish Highlands
Apparently the mailer.php on my website isn't working. Any ideas why?

Mailer.php;
PHP:
<?php 
if(isset($_POST['submit'])) { 
$to = "[email protected]"; 
$subject = "Website Contact"; 
$name_field = $_POST['name']; 
$email_field = $_POST['email']; 
$message = $_POST['message']; 
  
$body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message"; 
  
echo "Message has been submitted to $to!"; 
mail($to, $subject, $body);
} else { 
echo "error: no data sent!";
} 
?>

Contact.html;
Code:
<p>
If you have any questions regarding my images, purchasing images, my site, or simply wish to send me a message, then please send me an email via the form below.
</p>
		
<br />
		
<div class="contact">		
<form method="post" action="mailer.php" />
Name: <input id="name" type="text" class="inputbox" />
E-mail:<input id="email" type="text"  class="inputbox" />
<br />

Message<br />
<textarea class="textarea" id="message" cols="1" rows="1"></textarea>
<br />
</div>

<div style="text-align: right;">
Enter the code shown in the image:<br />
<input  class="inputboxsmall" type="text" 	name="protectwebformcode" value="" /><img src="http://protectwebform.com/image/22356/" alt="protectwebform" width="35px" height="20px" />
<input class="select" type="submit" value="Add" />
</div>

Page in question is;
http://www.afowler.co.uk/contact.php

Im sure it used to work :/
 
Thanks for the uggestions guys, but I have just stolen Jonny's script now. Im sure it used to work though, so no idea why it stopped. I must have deleted some code by accident. Right, now how do I get the mailer script to redirect to the contact page once its finished?
 
Back
Top Bottom