<?php
$value = 'yes';
echo "<input type='checkbox' name='subscribe' value='yes'/> Subscribe?";
if (isset($_POST['subscribe'])) {
if ($_POST['subscribe'] == $value) {
$subscribed = true;
} else {
$subscribed = false;
print 'Invalid checkbox value submitted.';
}
} else {
$subscribed = false;
}
if ($subscribed) {
print 'You are subscribed.';
} else {
print 'You are not subscribed';
}
|