Im trying to created a a simple form to email, having use it on my contact page it works fine, however I’m trying to modify it into a simple booking form with extra fields including telephone, check in/out dates etc. Its on this site:
However, Ive added extra vaiable e.g. “$checkin” and the form sends fine, although now the sender’s email address changes to firstname.lastname@example.org (my host) instead of the email entered by the person using the form. I have pasted the code below, I would be REALLY grateful if someone could help. Many Thanks Paul
$email_address = “email@example.com”; //This should be changed to your email address.
$subject_prefix = "Shalom House Booking Request | "; //This will be the subject prefix of all emails. default "Website Contact - User Subject
// — Do not modify below —
//Collects varibles from previous page.
//This part should prevent malicous doings.
//Most servers are setup in such a way that this section is not needed but its a good security precaution to have.
$from = urldecode($email);
if (eregi(“\r”,$from) || eregi("
print “Malformed Headers were detected.”;
//This part sends the email to you.
mail($email_address, $subject, $telephone, $checkin, “From: $name <$email>
X-Mailer: Simple PHP Contact Form 1.0 (www.korske.com)”);
//Redirects to sent.htm
Thank you for the help, especially Star Lion, much appreciated. I’m really struglling with PHP. Does anyone know of any good online resources to quickly learn the basics, as I know how to build a form and site easily with CSS but as I downloaded the php form I’m just doing guesswork.
I can see how the forms work to a certain degree but fixing errors/modification is my weakness.
Thanks for the help, I do have a good base of XHTML and CSS. I find it easy to hand code, but with PHP etc im bluffing my way through it. I can see how the mail works, it collects the variables set at the begining of the script and used from the “labels” in the form. But I know at the minitue I wouldnt be able to write a contact form from scratch.
I will go throught the W3C tutorials, I have briefly looked at them before. Do you know how I could add CAPTHA to the form? Do people write this code themselves or dot hey simply copy and paste to protect from Spam?