Hello Guys.... Im a first year student in web coding.
Im making my exam project right now and i really need you guys help for this simple thing :D.
In my school we are using PHP, and ofcause im making my menu with a database and php..
Well my problem is that i really want the (selected) feature in my menu... But since im pulling all of my menu point out in one, i dont know how seperate the selected option.
As you can see im not the best at english, so im just gonna show you guys my code and really hope u can help me, if u got any questions or there is something u dont understand, please ask me.
Here is where im pulling the menu points out of my database
the problem as u can see is i made a ID on my <li> named selected, but since on doing it this way it just counts for every single menu point
<?php
function menu($db){
echo '<ul>';
$sql_menu="SELECT * FROM menu";
$result_menu=mysqli_query($db,$sql_menu);
while($row_menu = mysqli_fetch_array($result_menu)){
echo '<b>';
echo '<li id="selected"><a href="index.php?side='.$row_menu['menu_id'].'">'.$row_menu['menu_text'].'</a></li>';
echo '</b>';
}
echo '</ul>';
}
?>
And here is my CCS
#menu1 ul {
list-style-type: none;
margin: 0;
padding: 0;
margin:0px 0px 0px 0px;
z-index:2;
}
#menu1 li {
float: left;
z-index:2;
}
#menu1 a:link, a:visited {
display: block;
width:136px;
height:18px;
color:black;
z-index:2;
text-align: center;
padding: 12px;
text-decoration:none;
text-transform: uppercase;
font-size:15px;
margin-top:10px;
}
#menu1 a:hover, a:active {
color:white;
background:#41A9DF;
border-radius:30px;
font-family: 'Dancing Script', cursive;
}
#menu1 li#selected a{
color:#F00;
}