在导航到不同的页面时更改我的网站标题的外观[关闭]

Hi i am new to web development. I am making a website of eCommerce. I have different pages in my website. For all pages i have made a header.php file because header remains almost same on different pages. But i want to customize my header in some cases. Like if i go to signin page from my home page then i would want my search bar to hide. how can i do this. do i have to make different header files for all pages or is there any other way too.

<?php require_once "header.php";?>

now on my signin page i am using my already made header.php file like this as shown in the above line. in my header.php i have my logo ,a search bar , sign in and signup option etc. that is fine for the home page but when i go to the signin page i want search bar as well as sign in and signup options to hide. i have tried this but still not working

<?php if ($_SERVER['REQUEST_URI']!="http://localhost/projectt/sign-up.php")    

      { echo '<div id="nav-search">
       <form>
       <table>
       <tr>
       <td>Search</td>
       <td><input type="text" placeholder="search for items" id="textbox" size="15px"/></td>
       <td><button type="submit" id="search" name="search" ></td>
       </tr>
       </table>
       </form>

       </div>
        </div>';
} 
?>

You can do this in two ways:

  1. (the one I would choose) Write your customised code for the login page and put it directly into the file
  2. Write a condition like this into header.php

    if($_SERVER['REQUEST_URI']!="addressofyourloginpage"){
    //the code you want to hide
            }