Gladelvira Posted March 29, 2023 Share Posted March 29, 2023 I have a problem with my <nav> bar ending up outside my <html> code, can someone help me explain where the problem is? <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Send</title> <link rel="stylesheet" property="stylesheet" type="text/css" href="css/stylesheet.css"> </head> <body> <?php session_name('Website'); session_start(); $host = "localhost"; $user = "josgla22"; $pwd = "_fLhYXqDRB"; $db = "josgla22_db"; $mysqli = new mysqli($host, $user, $pwd, $db); $navigation = <<<END <nav> <a href="index.php">Home</a> <a href="about.php">About</a> <a href="products.php">Products</a> END; if (isset($_SESSION['userId'])) { $navigation .= <<<END <a href="register.php">Register</a> <a href="logout.php">Logout</a> END; if ($_SESSION['username'] === 'admin') { $navigation .= '<a href="add_product.php">Add Product</a>'; } $navigation .= 'Logged in as ' . $_SESSION['username']; } else { $navigation .= <<<END <a href="login.php">Login</a> END; } $navigation .= '</nav>'; ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/316064-outsite-the/ Share on other sites More sharing options...
ginerjm Posted March 29, 2023 Share Posted March 29, 2023 (edited) What do you mean by 'outside'? Your code sure looks like the nav tag is issued after the html tag so I'm thinking that visually your page doesn't look good. Have you examined your web page use the browser tools to allow you to see what is behind what you see onscreen? Edited March 29, 2023 by ginerjm Quote Link to comment https://forums.phpfreaks.com/topic/316064-outsite-the/#findComment-1606931 Share on other sites More sharing options...
requinix Posted March 29, 2023 Share Posted March 29, 2023 Got multiple problems here, not the least of which is: I don't see where you actually output your $navigation. Quote Link to comment https://forums.phpfreaks.com/topic/316064-outsite-the/#findComment-1606939 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.