Folks,
How can I make use of the BOOLEAN Validator ?
I saw this:
Do you mind to show me a php example linked to an html form ?
Anyway, here’s my attempt to understand where you make use of this Boolean validator. See, if I understood correctly or not.
PHP
[code]
function validate_integer($value) {
//https://www.php.net/manual/en/filter.filters.validate.php
if(!filter_input(INPUT_POST, “string”, FILTER_VALIDATE_BOOLEAN))
{
echo(“Input is not valid”);
}
else
{
echo(“Input is valid”);
}
return filter_input($value);
}
Html
[code]
<form method = ‘POST’ action = “”>
<label for=’tos’>Agree To Tos: Yes</label>
<input type=’check’ name=tos’ id=’yes’>
<br>
<button type=’submit’>Search!</button>
</form>
So you use the BOOLEAN validator against html like the above ? Yes or no ?
I mean, would you check, using the Boolean Validator, if a checkbox is checked or not ? Is that why you use the Boolean Validator here ?
I guess there are more reasons to use it. But I want to know some good reasons and see some good html & php code samples.
Do show us a bunch of code samples (both html & php) of different uses where you would use the BOOLEAN Validator here.
Cheers!