I am trying to use the html post function with php to insert a 1 or 0 into a database depending on whether a user has ticked a checkbox or not, however I get index errors whenever i submit the form, no matter if the boxes are checked or not. How do I prevent this happening? The error i get is "Notice: Undefined index: Adventure Challenge Award in C:\xampp\htdocs\scout\insertbadgeinphp.php on line 15"
<?php
$servername = "127.0.0.1";
$username = "root";
$password = "";
$dbname = "scout";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 
if (isset($_POST['submit'])) {
if (!$_POST['Adventure Challenge Award'] == null)
{
    $aca = "1";
}
else{
    $aca = "0";
}
}
$sql = "INSERT INTO insertbadgescout (AdventureChallengeBadge)
VALUES ('$aca');";
if ($conn->multi_query($sql) === TRUE) {
    echo "New records inserted successfully");
}
else 
{
    echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
?>
<!DOCTYPE html>
<html> 
<head> 
<title>Insert badges scouts have</title> 
</head> 
<body id="body-color"> 
<div id="badges"> 
<form method="POST" action="insertbadgeinphp.php"> 
<input type="checkbox" name="Adventure Challenge Award" value="yes">Adventure Challenge Award<br>
<input id="button" type="submit" name="submit" value="Save Badges"> 
</form> 
</div> 
</body>
<p><a href="Homepage.html"> Home </a> </p> 
</html> 
 
     
     
     
    