PDA

View Full Version : Navigation Doesn't Show on Refresh


macleodjb
04-25-2007, 03:20 PM
I have a navigation that is having some problems. When a user log's in they are directed to main.php. Once the user hits this page the navigation displays fine, so the user now travels to another page, at this point the navigation sometimes appears and sometimes not. If the user were to click back to main.php the navigation would not show up. The weird thing is when you view source on the document that doesn't show the navigation it will be there in the html code, it's just not visible for some reason. Here is the code that i have for this navigation.


<DIV id=leftcol>
<UL id=nav>
<?php
if(isset($_SESSION['username'])) {
$level = $_SESSION['gid'];
if ($level >=1) {
echo '<LI><a href="./main.php">Main</a></LI>';
} else {
echo '<LI>Main</LI>';
}
if ($level >=1) {
echo '<LI><A href="./add_job.php">Add Job</A></LI>';
} else {
echo '<LI>Add Job</LI>';
}
if ($level >=1) {
echo '<LI><A href="./edit_job.php">Edit Job</A></LI>';
} else {
echo '<LI>Edit Job</LI>';
}
if ($level >=1) {
echo '<LI><A href="./add_rfi.php">Add RFI</A></LI>';
} else {
echo '<LI>Add RFI</LI>';
}
if ($level >=1) {
echo '<LI><A href="./add_note.php">Add Note</A></LI>';
} else {
echo '<LI>Add Note</LI>';
}
if ($level >=2) {
echo '<LI><A href="./installation.php">Installation</A></LI>';
} else {
echo '<LI>Installation</LI>';
}
if ($level >=2) {
echo '<LI><A href="./punch_list.php">Punch Lists</A></LI>';
} else {
echo '<LI>Punch Lists</LI>';
}
if ($level >=6) {
echo '<LI><A href="./users.php">Users</A></LI>';
} else {
echo '<LI>Users</LI>';
}
} else {
echo '<LI>Login To View Nav</LI>';
}
?>
</UL>
</div>


Thanks in advance for the help

FJbrian
04-25-2007, 03:26 PM
see your last echo line? What's that about?

macleodjb
04-25-2007, 03:33 PM
If the user is not logged in the link will display "Login to View Nav"

macleodjb
04-25-2007, 04:23 PM
I found out if i am on a page where the navigation shows in the html code but not on the screen, if i refresh (f5) the page it shows up again. What would make this happen?

FJbrian
04-26-2007, 03:19 AM
I don't understand PHP session vs old style cookies but for whatever reason PHP session always gives me probs when using the back button. That's what I thought you were having a prob with when I saw that last echo.