this is my first time here, so please bear with me.. this is my html form :
<form method="post" action="contactformprocess.php">
<input id="name" name="name" type="text" value="" />
<br />
<input id="phone" name="phone" type="text" value=" /><br />
<input id=" email " name="email " type="text " value=" " /><br />
<textarea rows="5 " id="message " name="message " cols="20 "></textarea><br />
<input id="submit " name="submit " value="שלחו " type="submit " ><br />
<input id="checkbox " type="checkbox " checked="yes " value="i want
to recive weekly updates from you "/> i want to recive weekly updates from you <br />
</form>
this is the php code im using :
<?php
$emailSubject = '.....';
$webMaster = 'aa@aa';
$name = $_POST['name'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$message = $_POST['message'];
$body = <<<EOD
<br><hr><br>
Subject: $option<br>
Name: $name <br>
Phone: $phone<br>
Email: $email <br>
Message: $message <br>
EOD;
$headers = "From: $email\r\n";
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
$success = mail($webMaster, $emailSubject, $body,
$headers);
?>
what I am missing is the php script that validates if the checkbox was unchecked(it's set to checked) or checked and sends the info together with the other fields. if checked send 'YES', if uncheck send 'NO' or nothing. thanks :)
var_dump
instead ofprint_r
. You want to see the types, as well. And since he is missing the checkbox'sname
-attribute, viewing$_POST
won't help him. ;-) – Basti Mar 26 '12 at 16:12