php – Undefined Variable and Warning: Invalid argument provided for foreach ()

am new on php
I'm trying to make an entrance of presence
but I get an undefined variable error and warning: invalid argument provided for foreach ()

        

          fetch_assoc ())
{


?>
          
            
            
            
            
            
            
              
              
              
              Present <input type = "radio" name = "presence[[[[]"value =" Present "> Missing <type of entry =" radio "name =" presence[[[[]"value =" Away ">
          

        

        

num_rows> 0)
{
while ($ check = $ result-> fetch_assoc ())
{
if ($ date == $ check['date']) {
$ b = true;
echo "
Presence already taken today!
"; } } } if (! $ b) { foreach ($ assistance as $ key => $ value) { if ($ value == "Present") { $ query = "INSERT INTO expectence_tbl (value, stid, date) values ​​(" Present, "$ key," date ")"; $ result = mysqli_query ($ conn, $ query); } other { $ query = "INSERT INTO waitence_tbl (value, stid, date) values ​​(" Away, $ key, $ date ")"; $ result = mysqli_query ($ conn, $ query); } } } }?>

when i click on the send button, it gives the error like
Note: Undefined variable: presence
Warning: Invalid argument provided for foreach ()