代码:
<input type="checkbox" name="discountedItem" <?php if (isset($_POST['discountedItem'])) echo "checked" . " " . "value='y'"; ?> />
如何将其转换为 if 语句,以便如果未检查其值为n
?
我试过:
<input type="checkbox" name="discountedItem" <?php if (isset($_POST['discountedItem'])) { echo "checked" . " " . "value='y'"; } else { echo "value='n'"; } ?> />
没用。该值只是NULL。