Jump to content

<nav> outsite the <html>


Gladelvira

Recommended Posts

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>

Link to comment
Share on other sites

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 by ginerjm
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.