I have a form on my website, but I have a problem passing the value of the checkbox.
I get the following error…
Notice: Undefined index: upgradeable in /var/www/vhosts/domain.com/httpdocs/***/includes/modules/admin.php on line 324 Unexpected error.
var_dump shows these errors…
Notice: Undefined index: upgradeable in /var/www/vhosts/domain.com/httpdocs/***/includes/modules/admin.php on line 325 NULL Notice: Undefined variable: upgradeable in /var/www/vhosts/domain.com/httpdocs/***/includes/modules/admin.php on line 327 Unexpected error.
My checkbox looks like this…
<input type="checkbox" name="upgradeable" class="" value="<?php echo $membership['upgradeable']; ?>" >
On admin.php line 324, looks like this…
$upgradeable = inputFilter($_POST['upgradeable']);
Can anyone please help me find the error.
The values of a checkbox are only sent if the checkbox is actually set to checked. If it is not checked, then the value is not set at all, so
$_POST['upgradable']will be undefined.Try this: