我的问题是,我有三个复选框,名称为newslettera,newsletterb和newsletterc,如果在我提交表单时没有选中复选框,我会收到一条错误,上面写着通知:未定义索引:newslettera不知道如何正确的想法使用isset()会做,但它不是??
由于
if(isset($_POST['submitbtn']))
{
$email = $_POST['email'];
$month = $_POST['month'];
$day = $_POST['day'];
$year = $_POST['year'];
if(isset($_POST['newslettera'])) { $newsletterachecked = 'checked'; }else{ $newsletterachecked =''; }
if(isset($_POST['newsletterb'])) { $newsletterbchecked = 'checked'; }else{ $newsletterbchecked =''; }
if(isset($_POST['newsletterc'])) { $newslettercchecked = 'checked'; }else{ $newslettercchecked =''; }
$emailtype ='html';
}
My form tags are
<br>Newslettera <input type="checkbox" value="a" name="newslettera" checked>
<br>Newsletterb <input type="checkbox" value="b" name="newsletterb" checked>
<br>Newsletterc <input type="checkbox" value="c" name="newsletterc" checked>