I've created a contact form which relies on a piece of php (mailer.php) to send through the data to a specified email address. When I submit the form I get an Error 404 Object Not Found page attached here:
error404.jpg (58.28K)
Number of downloads: 6
Not sure if it helps but I'm using Xampp as my virtual server.
Here's the code for the contact form:
<form action="mailer.php" method="POST" >
Fields marked (*) are required
<p>FirstName:* <br>
<input type="text" name="FirstName">
<p>LastName:* <br>
<input type="text" name="LastName">
<p>City:* <br>
<input type="text" name="City">
<p>Tel:<br>
<input type="text" name="Tel">
<p><input type="submit" name="submit" value="Submit">
</form>
<p>Here's the mailer.php code:
<?php
// get posted data into local variables
$EmailFrom = "Enquiry";
$EmailTo = "myname@myemail.com";
$Subject = "Enquiry";
$FirstName = Trim(stripslashes($_POST['FirstName']));
$LastName = Trim(stripslashes($_POST['LastName']));
$City = Trim(stripslashes($_POST['City']));
$Tel = Trim(stripslashes($_POST['Tel']));
// validation
$validationOK=true;
if (Trim($FirstName)=="") $validationOK=false;
if (Trim($LastName)=="") $validationOK=false;
if (Trim($City)=="") $validationOK=false;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}
// prepare email body text
$Body = "";
$Body .= "FirstName: ";
$Body .= $FirstName;
$Body .= "\n";
$Body .= "LastName: ";
$Body .= $LastName;
$Body .= "\n";
$Body .= "City: ";
$Body .= $City;
$Body .= "\n";
$Body .= "Tel: ";
$Body .= $Tel;
$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=ok.htm\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>Server Side scripting and PHP etc. is all pretty new to me. However, one thing which did occur to me is do I need an 'ok.htm' page sitting somewhere on my virtual server to be displayed as a 'Success' page?
Any help greatly appreciated.
Cheers
Help


















