I have this registration code. I want people to decide if they want to be added to an email listserv or not. The code executes appropriately when the box is checked but I get:
Notice: Undefined index: maillist in C:\xampp\htdocs\website\register.php on line 21
when the box is unchecked. Below is the code. I'm not great at programming so please pretend like I'm stupid when responding. Thanks.
    <tr><td>Add me to your listserve:</td><td><input type="checkbox" name="maillist">  </td></tr>
    $name=mysql_real_escape_string($_POST['name']);
    $dob=mysql_real_escape_string($_POST['dob']);
    $loginid=mysql_real_escape_string($_POST['loginid']);
    $password=mysql_real_escape_string($_POST['password']);
    $emailaddress=mysql_real_escape_string($_POST['emailaddress']);
    $description=mysql_real_escape_string($_POST['description']);
    $maillist=$_POST['maillist'];
    mysql_query("INSERT INTO demographics    values('$name','$dob','$loginid','$password','$description')") or DIE(mysql_error());
    if($maillist==true){
      mysql_query("INSERT INTO maillist values('$name','$emailaddress')") or DIE(mysql_error());
    }
 
     
     
    