simple contact form problem
Posted: Wed Jan 13, 2010 3:45 am
Hi,
This should be simple but..as a newbie:
I have created a simple php script for a contact form. I want to include dynamic content in the $message field, although it seems to only allow normal text:
This works:
This doesn't:
Full code:
I'm sure this is easy!
Thanks in advance.
This should be simple but..as a newbie:
I have created a simple php script for a contact form. I want to include dynamic content in the $message field, although it seems to only allow normal text:
This works:
Code: Select all
$message = ("Hi,</br></br>Your friend wanted to share our website, http://www.example.com with you. We hope you find it interesting!.</br></br>Kind Regards</br>example.com");Code: Select all
$message = ("Hi,</br></br> "[color=#BF0000].$name[/color]"wanted to share our website, http://www.example.com with you. We hope you find it interesting!.</br></br>Kind Regards</br>Example.com");Code: Select all
<?php
if(isset($_POST['submit'])) {
$email = $_POST['email'];
$name = $_POST['name'];
$to = $email;
$subject = ("recommendation from: ".$name);
$message = ("Hi,</br></br> ".$name"wanted to share our website, http://www.example.com with you. We hope you find it interesting!.</br></br>Kind Regards</br>example.com");
$header = ("From:Recommendation from: ".$name);
if(mail($to,$subject,$message,$header)) {
$result = "Many thanks for recommending us to a friend";
} else {
$result = "<h3>Error sending your message.</h3>
Sorry, an error occured sending.<br />Please try again later or contact us direct to be added to the mailing list";
}}
?>Thanks in advance.