如果提交的所有字段都不为空,则显示表格中的问题

I have three fields which are related to each other and i am getting 2nd value after submitting the 1st varibale and 3rd value after submitting 2nd field

I have these 3 fields which are interrelated to each other

<?php 

    $courtname='';

    if(!empty($_POST['court_name']))
    {
      $courtname=$_POST['court_name'];
     }


    $category='';

    if(!empty($_POST['category']))
    {
      $category=$_POST['category'];
    }

    $lawyer_name='';

    if(!empty($_POST['lawyer_name']))
    {
      $lawyer_name=$_POST['lawyer_name'];
    }


?>

And i want to show this div part only when all the above 3 fields are submitted

<?php 
if($lawyer_name!=="" && $courtname!=="" && $category!==""){?>
    <div>
!--- Some Code ----!

    </div> 
<?php } ?>

But this if condition is not working ..and div part is showing after submitting 2 fields ..Its not checking for 3rd condition .

I have also used

<?php  if(!empty($_POST['court_name']) && !empty($_POST['category']) && !empty($_POST['lawyer_name'])   ){ ?>

but that's also not working.

Try with :

<?php  
  if( isset($_POST['court_name']) && isset($_POST['category']) && !isset($_POST['lawyer_name'])   ){ 
  // code
  }

?>