Answer the question
In order to leave comments, you need to log in
Is class active not being set for a button on a page?
Good afternoon!
In the list, the button should be active when the user is on the current page.
Why isn't this happening? where is the mistake?
<div class="header">
<ul class="nav_menu">
<?php
$url = $_SERVER['REQUEST_URI'];
if($url == "/multipulty.ru/multipulty.ru/o_nas.php")
{
$url1 = "active";
}
elseif($url == "/multipulty.ru/multipulty.ru/forum.php")
{
$url2 = "active";
}
else
{
$index = "active";
}
?>
<li class="<?php $index?>"><a href="index.php">Главная</a></li>
<li class="<?php $url1?>"><a href="o_nas.php">О нас</a></li>
<li class="<?php $url2?>"><a href="forum.php">Форум</a></li>
</ul>
</div>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question