|
Posted by agent on 10/11/24 11:54
Hi
I'm using PHP without properly understanding is, on a server i don't
have access to. It was working, but now it's stopped. It's a
three-field form on a website to be emailed to me. everything appears
to work, but the mail never arrives. I'd be very grateful if someone
can tell me if I've done something stupid or if I need to get on to
the server manager.
RichardF
The form:
<form method="post" action="contact.php">
<p>Name <input name="Name" type="text" size="40"> Email or
phone <input type="text" name="Contact" size="30"></p>
<p>Anything else to say?</p>
<p><textarea name="OtherInfo" cols="60"
rows="10"></textarea></p>
<input name="Submit" type="submit" id="Submit" value="Send
now">
<br><input name="Reset" type="reset" id="Reset"
value="Clear">
</form>
The contact.php file:
<?php
//PHP email handling script for Drive Well!
//Edited RF July 2006
// get posted data into local variables
$EmailTo = "enquiry@drive-well.com";
$EmailFrom = "info@drive-well.com";
$Subject = "Drive Well! enquiry";
$Name = Trim(stripslashes($_POST['Name']));
$Contact = Trim(stripslashes($_POST['Contact']));
$OtherInfo = Trim(stripslashes($_POST['OtherInfo']));
// validation
$IsOK=true;
if (Trim($Name)=="") {
$IsOK=false;
}
else if (Trim($Contact)=="") {
$IsOK=false;
}
if (!$IsOK) {
print "<meta http-equiv=\"refresh\"
content=\"0;URL=reply_error.html\">";
exit;
}
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Contact: ";
$Body .= $Contact;
$Body .= "\n";
$Body .= "Other info: ";
$Body .= $OtherInfo;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success or failure page
if ($success) {
print "<meta http-equiv=\"refresh\"
content=\"0;URL=reply_ok.html\">";
}
else {
print "<meta http-equiv=\"refresh\"
content=\"0;URL=reply_error.html\">";
}
?>
Navigation:
[Reply to this message]
|