navbar.php (1279B)
1 <?php 2 include_once 'config.php'; 3 4 if (isset($_SESSION['username'])) { 5 $user = $_SESSION['username']; 6 $profile = $user . "'s Profile"; 7 } else { 8 $profile = "Profile"; 9 } 10 11 $sql = "SELECT survey_id FROM survey ORDER BY RAND() LIMIT 1;"; 12 $result = mysqli_query($connect, $sql) or die(mysqli_error($connect)); 13 $feelinLucky = mysqli_fetch_assoc($result); 14 $luckyUrl = "takesurvey.php?sid=" . $feelinLucky['survey_id']; 15 ?> 16 17 <style> 18 .navbox{ 19 border-radius: 25px; 20 margin: 0; 21 padding: 10px; 22 background-color: #40e0d0; 23 } 24 25 .nav { 26 display: inline; 27 overflow: hidden; 28 font-family: Arial; 29 } 30 31 .nav a { 32 border-radius: 25px; 33 float: left; 34 font-size: 16px; 35 color: #000; 36 background-color: #40e0d0; 37 text-align: center; 38 padding: 10px 16px; 39 text-decoration: none; 40 } 41 42 .nav a:hover, .drop:hover .dropbtn { 43 background-color: #31b6a8; 44 } 45 </style> 46 <div class=navbox> 47 <div class= nav> 48 <a href="index.php" target=""> Home </a> 49 <a href="directory.php" target=""> Surveys </a> 50 <a href="createsurvey.php" target=""> Create a Survey </a> 51 <a href="profile.php" target=""> <?php echo $profile; ?> </a> 52 <a href="<?php echo $luckyUrl?>" target=""> Feeling Lucky? </a> 53 </div> 54 <br><br> 55 </div>