[Solved] How to stop the search field giving results even if the search field is empty?


In your search.php, add this code, above your existing logic ( in fact in an if else ).

    <?php

      if(!empty($_POST['search_term'])){
       //Your Existing Logic
      }
     else{
      echo 'No results/You should enter a keyword';
     }
   ?>

3

solved How to stop the search field giving results even if the search field is empty?