I am working on a new site which has a contactform to send an e-mail.
This works fine
form has the following fields: name, email, phone, website, subject and message
site is here: http://tinyurl.com/7vzgl7z
I now want to add a checkbox that people can check if they want to receive a "questionnaire"
I added this to my form like so:
<label for="questionnaire">Yes, please send me the questionnaire</label>
<input type="checkbox" id="questionnaire" name="questionnaire" value="yes">
The mail is then send by the send.php file like so:
$post = (!empty($_POST)) ? true : false;
$name = stripslashes($_POST['name']);
$email = trim($_POST['email']);
$phone = stripslashes($_POST['phone']);
$website = stripslashes($_POST['website']);
$subject = stripslashes($_POST['subject']);
$message = stripslashes($_POST['message']);
$error = '';
// some more code
My question is how to get the checkbox value to be sent to my e-mail
I found some examples on the web, but still can't get it to work.
You put me on the right track. I already tried that but couldn't get it to work at first, forgot that I had to still *mail* the questionnaire value like this:
$message = "$name has sent a message trough your website\nPhone: $phone\nWebsite: $website\n\nMessage:\n$message\nQuestionnairet:\n$questionnaire";
$mail = mail(WEBMASTER_EMAIL, $subject, $message,
"From: ".$name." <".$email.">\r\n"
."X-Mailer: PHP/" . phpversion());
Europe, Middle East and Africa