GET is working weird?

Hey guys! I have a page that displays different things when you click on different links, but it’s all done on one page. here’s the code scheme i have:

<?php
if(!isset($_GET['page'])){  ?>
<div id="container">
    <nav>
        <ul>
            <li><a href="<?php echo $_SERVER['PHP_SELF']; ?>?page=make_post">Make a Post</a></li>
            <li><a href="<?php echo $_SERVER['PHP_SELF']; ?>?page=view_posts">View Posts</a></li>
            <li><a href="home.php">Go to Feed</a></li>
        </ul>
    </nav>
</div>
    <?php }elseif(isset($_GET['page']) == 'make_post'){?>
<div id="post-form">
    post form test
</div>
    <?php  }elseif(isset($_GET['page']) == 'view_posts'){ ?>
<div id="view-posts">
    view post test
</div>
    <?php } ?>

it was working yesterday, but while editing i must have changed something to make it not work but when you click the ‘view posts’ link, it displays the ‘make a post’ page. but when you click the make a post link, it displays the right content. i can’t figure out why the view posts link doesn’t work…help??

I’m certainly not an expert in this area but it seems like this is a bit off:

<?php }elseif(isset($_GET['page']) == 'make_post'){?>

Using isset() will return a boolean value but yet you’re checking that boolean value against a string, ‘make_post’. I would remove the isset() as it’s unnecessary here.

<?php }elseif($_GET['page'] == 'make_post'){?>

Do the same for the other elseif statement.

Jeff’s pretty much got it on the head.

more likely, caleb, you meant to do a combination and just forgot the middle part;
if(isset($_GET[‘page’]) && $_GET[‘page’] == ‘make_post’)

OH! stupid mistake =P thanks guys!

You really don’t need to use isset() for the second two if statements as the first one already checks to see it it’s set.

A fair point. Given that the first if checks for the inverse-isset, all ElseIf’s attached to it are guaranteed to have passed this check. Good catch.

.-)