I can't find an example on this page that is relevant to sending mail from a form.
Please could someone send me a link to some sample code where I can just copy and paste and change the relevant bits. I have tried several times with various code but it seems too ellaborate for what I need and doesn't work (due no doubt to to me messing it up).
Apologies for being an idiot. I did this same function ages ago and I remember it being pretty easy.
For example with this code I've used it won't even display the initial form page:
http://www.harbourstudios.com/online_application.php
Here's the initial code:
<?php // <= This has to be the very first tag on your page. No comments, no whitespace. NOTHING!
include("php/v.inc");
include("php/q.inc");
$validator = new ValidateForm();
if ($HTTP_SERVER_VARS['REQUEST_METHOD'] == 'POST'){
$validator->addCheck('First_and_Last_name');
$validator->addCheckEmail('Email_address');
$validator->addCheck('Comment');
if ($validator->validate() && checkAnswer()){
//send email or another action to be performed
$SendTo = "oliver.coquelin@harbourstudios.com";
$FromString .= "from: ". $validator->get("Email_address") ."\r\n";
$Indhold .= "Navn: ". $validator->get("First_and_Last_name") ."\r\n";
$Indhold .= "Email: ". $validator->get("Email_address") ."\r\n";
$Indhold .= "Comment:\r\n".preg_replace("(\r\n|\r|\n)","\r\n",$validator->get("Comment"))."\r\n\r\n";
$MailSuccess = mail($SendTo,$Subject,$Indhold,$FromString);
header("Location: http://domain1263419.sites.fasthosts.com/online_application_thankyou.htm");
exit;
}
}
?>
I'm putting this on my form page above the opening HTML tag. It just results in the error mesages you can see at the link above.