Jump to content

Not triggering IF statement


HDFilmMaker2112

Recommended Posts

The below isn't triggering the second if statement:

 

if($_GET['admincp']!=""){
echo '<div class="center"><a href="./index.php?admincp">Admin CP</a>';

if($_GET['do']=="edit"){ 
(isset($_GET['id']) ? ' &#187; <a href="./index.php?admincp=users&do=edit">Edit Users</a>' : '');
}
elseif($_GET['view']=="accounts"){ 
(isset($_GET['id']) ? ' &#187; <a href="./index.php?admincp=investors&view=accounts">View Accounts</a>' : '');
}
echo '</div>';
}

 

 

When a user is at index.php?admincp=users&do=edit&id=someid they should see Admin CP >> Edit Users

 

When a user is at index.php?admincp=investors&view=accounts&id=someid they should see Admin CP >> View Accounts

 

Right now only Admin CP shows up.

Link to comment
https://forums.phpfreaks.com/topic/247009-not-triggering-if-statement/
Share on other sites

You aren't echoing anything past the Admin CP link. The ternary statements should be in this format.

 

echo isset($_GET['id']) ? ' » <a href="./index.php?admincp=users&do=edit">Edit Users</a>' : '';

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.