Hi,
Thanks for your replies.
I changed it to the following and now it works OK
HTML Code:
<form method="Post" action="contactengine.php">
But..... I generated a second form utilising this one once we got it working, I created two new fields - one of them works OK but the other is still coming through blank.
The 'Journal' field comes through blank.
One interesting thing: the 'Tel' field was originally called 'Telephone' and it didn't work, but then I shortened it to 'Tel' and it worked OK!?!?
Do you guys have any suggestions please?
HTML Code:
<div id="formcontainer">
<form method="Post" action="pressengine.php">
<fieldset>
<legend>For press and media requests, please fill in the the form below.</legend>
<p>
<label for="Name">Name: </label>
<input type="text" name="Name" id="Name" />
</p>
<p>
<label for="Journal">Journal: </label>
<input type="text" name="Journal" id="Journal" />
</p>
<p>
<label for="Email">Email Address: </label>
<input type="text" name="Email" id="Email" />
</p>
<p>
<label for="Tel">Tel:</label>
<input type="text" name="Tel" id="Tel" />
</p>
<p>
<label for="Message">Message:</label>
<textarea name="Message" rows="10" cols="20" id="Message">
</textarea>
</p>
<div>
<input type="Submit" name="Submit" id="Submit" value="Submit" class="btn" />
</div>
</fieldset>
</form>
</div>
pressengine.php:
PHP Code:
<?php
$EmailFrom = "johnhathway@waitrose.com";
$EmailTo = "john@johnhathway.co.uk";
$Subject = "A Press Enquiry";
$Name = Trim(stripslashes($_POST['Name']));
$Email = Trim(stripslashes($_POST['Journal']));
$Email = Trim(stripslashes($_POST['Email']));
$Tel = Trim(stripslashes($_POST['Tel']));
$Message = Trim(stripslashes($_POST['Message']));
// validation
$validationOK=true;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Journal: ";
$Body .= $Journal;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Tel: ";
$Body .= $Tel;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=pressthanks.php\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>
Bookmarks