Home >Backend Development >PHP Tutorial >Example of using php to verify checkbox validity_PHP Tutorial

Example of using php to verify checkbox validity_PHP Tutorial

WBOY
WBOYOriginal
2016-07-13 10:25:09848browse

The php code to verify the checkbox is as follows:

Copy code The code is as follows:
/**
* Verify checkbox validity in php
*/
$value = 'yes';
echo " Verify data";

if (isset($_POST['subscribe' ])) {
if ($_POST['subscribe'] == $value) {
$subscribed = true;
} else {
$subscribed = false;
print 'Submit The checkbox value for is invalid. ';
}
} else {
$subscribed = false;
}

if ($subscribed) {
print 'Verification valid! ';
} else {
print 'Verification invalid! ';
}

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/825165.htmlTechArticleVerify the php code of the check box as follows: Copy the code as follows: ?php /*** Verify checkbox validity in php* / $value = 'yes'; echo "input type='checkbox' name='subscribe' v...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn