Charles Charles - 5 months ago 8x
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 } ?>


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>