包括header.php css,不会工作包括footer.php或正文

I am attempting to require '_header.php'; and require '_footer.php'; so I can create a dynamic body for my site.

However none of the CSS will work in the body or in the footer. CSS will only work for the header.

Why is this happening and how could it be solved?

require '_header.php';



$form_to_echo = '<div class="form_wrap"><form id="registration" action="new_user.php" method="post">                                                                

    <div class="i_group"><span class="s_name">Класа:</span> 
    <input type="radio" id="_rad_rnk_class_h" name="rank_class" value="H"'.$_frm_selected_rank_class_h.'><label for="_rad_rnk_class_h">Хоби</label>
    <input type="radio" id="_rad_rnk_class_t" name="rank_class" value="T"'.$_frm_selected_rank_class_t.'><label for="_rad_rnk_class_t">Трофеј</label>
    </div>

    <input type="text" id="cell_phone" name="cell_number" placeholder="Мобилен телефон" value="'.$_POST['cell_number'].'">
    </div>  

    <div class="i_group"><span class="s_name">Крвна група:</span><br><br>                               
    <input type="radio" id="_rad_bld_typ_a" name="blood_type" value="A"'.$_frm_selected_bld_typ_a.'><label for="_rad_bld_typ_a">A</label>
    <input type="radio" id="_rad_bld_typ_b" name="blood_type" value="B"'.$_frm_selected_bld_typ_b.'><label for="_rad_bld_typ_b">B</label>
    <input type="radio" id="_rad_bld_typ_ab" name="blood_type" value="AB"'.$_frm_selected_bld_typ_ab.'><label for="_rad_bld_typ_ab">AB</label>
    <input type="radio" id="_rad_bld_typ_o" name="blood_type" value="O"'.$_frm_selected_bld_typ_o.'><label for="_rad_bld_typ_o">O</label>
    </div>                                      
    <div class="i_group">               
    <input type="submit" name="submit" class="submit" value="Pегистрирај">
    </div></form></div>';


if ($error_count_up != 0) { 

    echo $form_to_echo; 

}

require '_footer.php';  

When I copy and paste the code in HTML it works just fine...


<!DOCTYPE html>
<html>


    <head lang="mk">
        <meta charset="utf-8">


        <link rel="stylesheet" type="text/css" href="style.css">


        <link rel="stylesheet" type="text/css" href="./css/font-awesome.min.css">

        <title>;</title>
        <style type="text/css">

</style>



               <script src="//ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> 
               <!--<script src="script.js"></script> -->


                 <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
                  <script src="//code.jquery.com/jquery-1.12.4.js"></script>
                  <script src="//code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
                  <script>
                        $( function() {
                            $( "#datepicker" ).datepicker({
                                changeMonth: true,
                                changeYear: true
                            });
                        $( "#datepicker" ).datepicker( "option", "dateFormat", "dd-mm-yy" );
                        } );
                  </script>

    </head>





    <body>      



        <div id="showcase">


            <div id="sw_img1"></div>
            <div class="img_fade"></div>

                <div class="main_wrapper">

                    <div id="logo"></div>


                    <ul id="top_nav">

                        <li>Правилник</li>

                        <li>Контакт</li>    

                    </ul>


                </div>

        </div>

        <div class="test1">test</div>






    </body>





</html>

Try using include... PHP: include

you use:

<link rel="stylesheet" type="text/css" href="style.css">

so, style.css should be in the same folder where the URL is executed (not where the .php file is placed)

for example, if you visit 'example.com/dir1/dir2/mypage.htmlthenstyle.cssshould be indir2`

i advice to use the root urls for styles,scripts, images, like this:

..........................  href='/style.css' .........

and put style.css in root example.com/ folder.