Include doesn't work

i made a website with a include but he doesn’t include it from the home out of the folder “inc”

my code on the home:
include 'http://kingdomserver.000webhostapp.com/inc/menu.php';

my code in the folder inc:

<?php 
    session_start();
    if ($_SESSION["loged_in"] = "true" and $_SESSION["user"] != "") {
        
        echo '
                      
                <div class="dropdown">
                    <button class="dropbtn" onclick="myFunction()">User: '. $_SESSION["user"] . ' 
                <i class="fa fa-caret-down"></i>
                </button>
                <div class="dropdown-content" id="myDropdown">
                    <a href="/account">Account</a>
                    <a href="/log-out">Log-Out</a>
             </div>
            </div> 
        
        ';
        include '/inc/menu.html';
    } else {
        echo '
                <div class="dropdown">
                    <button class="dropbtn" onclick="myFunction()">account 
                <i class="fa fa-caret-down"></i>
                </button>
                <div class="dropdown-content" id="myDropdown">
                    <a href="/log-in">Log In</a>
                    <a href="/register">Register</a>
             </div>
            </div> 
        
        ';
        }
        ?>
</div>

Any errors thrown? :slight_smile:

sorry here are the errors:
Warning: include(/inc/menu.php): failed to open stream: No such file or directory in /storage/ssd4/567/5514567/public_html/Home/index.php on line 4
Warning: include(): Failed opening ‘/inc/menu.php’ for inclusion (include_path=’.:/usr/share/pear:/usr/share/php’) in /storage/ssd4/567/5514567/public_html/Home/index.php on line 4

can someone help me?

Remember that file names are case sensitive.

Wait, you are echoing those divs at the top of everything, no?
I mean, the PHP vode is placed at top, means everything will be echoed before <!DOCTYPE html>

1 Like

Is your issue fixed now? I can see a black menu on your site.

Yes i did include ‘…/Inc/menu.php’ noe iT works