php CEK jika data kosong

<?php 
        
include 'connection.php';

        
//create variable to store data
        
$user=$_POST['user'];
        
$password1=$_POST['password1'];
        
$password2=$_POST['password2'];
        
$email=$_POST['email'];
        
$phone=$_POST['phone'];
        
$company=$_POST['company'];
        
$address=$_POST['address'];
        
        
// CEK IF DATA NOT EMPTY
    
            //cek if password anda retype password in same
            
if($password1!=$password2){
                echo 
'<h2>Password and Retype Password must be in same!</h2>';
                
            }else{
                
//save data to database
                // creating query
                
$query="INSERT INTO user_login (user, password, email, phone, address) VALUES 
                ('$user', '$password1', '$email', '$phone', '$address' )"
;
                
                
$result=@mysql_query($query)or die(mysql_error());
                if(
$result){
                    echo 
'<h2>Registration Success</h2><br><a href="index.php">Continue Login</a>';
                }else{
                    echo 
'<h2>Error!! Can not save data to database!</h2>';
                }
            }
            
        
?>




if(empty($user) || empty($password1) || empty($password2) || empty($email) || empty($phone) || empty($company) || empty($address) ){
            echo 
'<h2>Sorry data incomplete</h2>';
}