开发者

Problem proccessing checkbox on MAMP

I have two separately named checkboxes sending values to the following sc开发者_StackOverflowript. 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";
}


Use isset():

$form = isset($_POST['form']) ? true : false;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜