如何查看哪个复选框被选中?

2021-12-21 00:00:00 input checkbox php html checked

如何在 PHP 中检查 checkbox 是否被选中?

How do I check in PHP whether a checkbox is checked or not?

推荐答案

如果复选框被选中,则复选框的值将被传递.否则,该字段不会在 HTTP 帖子中传递.

If the checkbox is checked, then the checkbox's value will be passed. Otherwise, the field is not passed in the HTTP post.

if (isset($_POST['mycheckbox'])) {
    echo "checked!";
}

相关文章