In the database I have the column Active
type tinyint(1)
In the form
<input type="checkbox" id="proActive" name="proActive" checked value="1">
I send it by method POST
and I receive it ...
$active = filter_input(INPUT_POST, 'proActive', FILTER_VALIDATE_BOOLEAN);
In theory the value of $active
would be 0
or 1
, but only take the value of 1
when this checked
but if you do not check proActive
comes as not signed.
I've done it this way ...
if (!isset($_POST['proActive']))
$active = 0;
and it works, the question is
Is there in PHP
any conditional as if (condicion, valorVerdadero, ValorFalso)
so that it is more practical? Well I have 24 checkbox
in the form.
Thanks for your help