[Phpwm] PHP contact form enquiry
Idvaughan at aol.com
Idvaughan at aol.com
Sun Apr 11 21:27:12 UTC 2010
Hi
I have the following php script to process an email form, however in the
from field of the email recieved how can I get it to display the users
email? At present it just says web _enquiry at webhost.com_
(mailto:enquiry at webhost.com) ?
Any ideas would be most welcome, and would be interested in learning on how
the form could be made more secure (as at present the server side
validation is not working) and streamlined. I have looked through the W3 schools
site but would appreciate an expert opinion on the best approach.
---------------- SCRIPT---------------------
<?php
// email Contact Form Generator
// _http://www.tele-pro.co.uk/scripts/contact_form/_
(http://www.tele-pro.co.uk/scripts/contact_form/)
// This script is free to use as long as you
// retain the credit link
// get posted data into local variables
$EmailFrom = "Web Enquiry";
$EmailTo = "myemail at domain.com;
$Subject = "Web Enquiry";
$name = Trim(stripslashes($_POST['name']));
$tel = Trim(stripslashes($_POST['tel']));
$email = Trim(stripslashes($_POST['email']));
$comment = Trim(stripslashes($_POST['comment']));
// validation
//$validationOK=true;
//if (Trim($name)=="") $validationOK=false;
//if (Trim($email)=="") $validationOK=false;
//if (Trim($comment)=="") $validationOK=false;
//if (!$validationOK) {
// print "<meta http-equiv=\"refresh\"
content=\"0;URL=contactus1.html\">";
// exit;
//}
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $name;
$Body .= "\n";
$Body .= "Telephone Number: ";
$Body .= $tel;
$Body .= "\n";
$Body .= "Email Address: ";
$Body .= $email;
$Body .= "\n";
$Body .= "Web Enquiry: ";
$Body .= $comment;
$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=thankyou.html\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=contactus1.html\">";
}
?>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.lug.org.uk/pipermail/phpwm/attachments/20100411/9ea8293e/attachment.htm
More information about the Phpwm
mailing list