I just need to submit 'Yes' if a checkbox has been clicked or 'NO' if it hasn't. Everything else is working and I can receive the email, but I do not get the value of the checkbox 'newsletter'.
html:
<label>
<label class="checkbox-inline">
<input type="checkbox" name="newsletter" id="newsletter" value="Yes" checked><label for="newsletter"><strong>I want to sign up for the newsletter.</strong></label>
</label>
</label>
php: `if(isset($_POST['email'])) {
$name = $_POST['name'];
$email = $_POST['email'];
$distributor = $_POST['distributor'];
$company = $_POST['company'];
$department = $_POST['department'];
$country = $_POST['country'];
$comments = $_POST['comments'];
$newsletter = $_POST['newsletter'];
if ($newsletter != 'Yes') {
$newsletter = 'No';
}
$fields = array(
0 => array(
'text' => '<b>Name',
'val' => $_POST['name']
),
1 => array(
'text' => '<b>Email',
'val' => $_POST['email']
),
2 => array(
'text' => '<b>Distributor / Reseller',
'val' => $_POST['distributor']
),
3 => array(
'text' => '<b>Company / Facility',
'val' => $_POST['company']
),
4 => array(
'text' => '<b>Department',
'val' => $_POST['department']
),
5 => array(
'text' => '<b>Country',
'val' => $_POST['country']
),
6 => array(
'text' => '<b>Comments',
'val' => $_POST['comments']
),
7 => array(
'text' => '<b>Join the mailing list?',
'val' => $_POST['newsletter'],
)
);
$message = "";
foreach($fields as $field) {
$message .= $field['text'].":</b> " . htmlspecialchars($field['val'], ENT_QUOTES) . "<br>\n";
}`
Aucun commentaire:
Enregistrer un commentaire