I use this html code in a page .tpl
<input name="prova" type="checkbox" id="prova" value="1" checked="checked">
and in php page use
'prova' => Tools::getValue('prova')
to get a checkbox value,
but when I try to print it is empty
I use this html code in a page .tpl
<input name="prova" type="checkbox" id="prova" value="1" checked="checked">
and in php page use
'prova' => Tools::getValue('prova')
to get a checkbox value,
but when I try to print it is empty
If you submit the form without checking checkbox, then browser will not send checkbox value. To check whether the checkbox is submitted or not, use the below code:
'prova' => Tools::getValue('prova', false);
If the checkbox is not submitted then it will return false otherwise return either the "on" or "1" value for that checkbox.