在空值和0之间有所不同

Its' about a form to enter results of a soccer tournament.

The form got the already inputed data from the db and writes it into the value argument of the html form. If the value in the db NULL so in the html i got

value=""`

It's important that games with no inputs doesn't make a change in the db so i filter it before i do the query. But now could it happen that a game ends 0 : 0 But the db won't safe that. How can i say the system its not empty/NULL it is 0?

      if(!empty($_POST[$tore_heim] OR !empty($_POST[$tore_gast]))){
         $spiele_save = "UPDATE spiele SET tore_heim = '".$_POST[$tore_heim]."', tore_gast = '".$_POST[$tore_gast]."' WHERE id_spiele = ".$spiele_id[$i]."";    
         $spiele_save = mysqli_query($con, $spiele_save);};
        };

Thank you deceze

    if(isset($_POST[$tore_heim]) && strlen($_POST[$tore_heim]) > 0 
    OR
    isset($_POST[$tore_gast]) && strlen($_POST[$tore_gast]) > 0)

The Problem is solved!

Check if value is '0': !empty($_POST[$tore_gast])) || $_POST[$tore_gast] === '0'

look at this example.

function isEmpty( $variable ){

    return ( 
     !isset($_POST[$variable]) ||
     ( empty($_POST[$variable]) && $_POST[$variable] !== "0" ) 
    );

}

if ( !isEmpty($tore_heim) ){

    // run your code here...

}