我想要做的是在复选框标签上显示数据库中的值。我已经做了那个部分:
$acc = $truckerController->GetAccessory();
$acc_result = "<form action='' method='post'>";
foreach ($acc as $value) {
$id = $value->id;
$device = $value->device;
$acc_result .= "<input type='checkbox' name='$device' id='$device' value='$id'>"
. "<label for='$device'>$device</label> ";
}
$acc_result .= "<input type='submit' name='acc_submit' value='submit'><form/>";
echo $acc_result;
但我想要完成的是提交检查值时,我似乎无法获得检查值。
if (isset($_POST["acc_submit"])) {
echo $_POST["$device"];
}
请帮忙!