tags:

views:

14

answers:

1

Hello

I have two separately named checkboxes sending values to the following script. I seem completely unable to reliably tell if the checkboxes are on or off.

I have checked the values are being sent in the $_POST and they are as expected. Please help!

$form = $_POST['form'];
$recruit = $_POST['recruiting'];


if (empty ($form)) {
    $form = "0";
} else {
    $form = "1";
}

if ($recruit) {
    $recruit = "0";
} else {
    $recruit = "1";
}
+1  A: 

Use isset():

$form = isset($_POST['form']) ? true : false;
igorw
For reference. Why does empty() not work here?
YsoL8
igorw