Charles Charles - 1 year ago 95
PHP Question

PHP syntax - shows text and not link

With this snippet of code, I'm attempting to show a clickable link (if "admin" is logged in), which will redirect me to adminarea.php

Right now it just prints out "Admin" in text. Nothing to click on. Just simple text.

Am I missing anything? Surely I got it wrong but I cannot see what's missing.

Here is the code:

<?php if (getUser("user") == "admin") { ?>
<option value="adminarea.php">Admin</option>
<?php } ?>

Answer Source

You're printing an option, which is part of the select form input. You're probably looking for an anchor?

<a href="adminarea.php">Admin</a>

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download