Forum
24
bd

















1. First of all registration here 2. Then Click on Be a trainer or writer button 3. Collect your trainer or writer id card from trainer master 4. And create post here for earn money! 5. For trainer 100 tk minimum withdraw 6. For writer 500 tk minimum withdraw 7. Payment method Bkash Only
obaydulbc obaydulbc
Trainer

2 years ago
obaydulbc

php header menu design for user's



<style>
.header-menu {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px;
background-color: #f2f2f2;
}

.logo img {
height: 50px;
}

.navigation {
list-style: none;
display: flex;
margin: 0;
padding: 0;
}

.navigation li {
margin-right: 20px;
}

.navigation li:last-child {
margin-right: 0;
}

.navigation a {
text-decoration: none;
color: #333;
font-weight: bold;
font-size: 16px;
}

.navigation a:hover {
color: #ff6600;
}
</style>


this php code is using for user's header menu
<nav class="header-menu">
<div class="logo">
<a href="index.php"><img src="logo.png" alt="My Website"></a>
</div>
<ul class="navigation">
<li><a href="index.php">Home</a></li>
<li><a href="about.php">About</a></li>
<?php if (isset($_SESSION['user'])) { ?>
<li><a href="dashboard.php">Dashboard</a></li>
<li><a href="logout.php">Logout</a></li>
<?php } else { ?>
<li><a href="login.php">Login</a></li>
<li><a href="register.php">Register</a></li>
<?php } ?>
</ul>
</nav>



This is a conditional statement in PHP that checks whether the $_SESSION['user'] variable is set or not.

The isset() function checks if a variable is set and is not NULL. In this case, it is checking if the $_SESSION['user'] variable is set or not. The $_SESSION variable is a global variable in PHP that is used to store and retrieve data across multiple pages of a website.

If the $_SESSION['user'] variable is set, the code inside the first curly braces { } will be executed. This code displays two navigation links for the dashboard and logout pages.

If the $_SESSION['user'] variable is not set, the code inside the second curly braces { } will be executed. This code displays two navigation links for the login and register pages.

Overall, this code is used to create a dynamic navigation menu that changes depending on whether the user is logged in or not. If the user is logged in, they will see links to access their dashboard and logout. If the user is not logged in, they will see links to login and register


×

Alert message goes here

Plp file


Category
Utube fair

pixelLab দিয়ে নিজের নাম ডিজাইন ও Mocup

Paid hack

App link topup