0

HOW CAN I STYLE THE ANCHOR TAG IN ECHO?

if(isset($_SESSION['valid']))
{   

    include("config.php");

    $result = mysqli_query($conn, "select * from users");
    echo "<a href='view.php'>View and Manage Users</a>";
    echo "<br/>"; 
    echo "<a href='viewdept.php'>View and Manage Departments</a>";
    echo "<br/>";
    echo "<a href='viewrep.php'>View and Manage Reports</a>";
    echo "<br/><br/>"; 
    echo "<b>Login List:</b><br/>";
    echo "<table width='35%'>";
    echo "<tr  bgcolor='#CCCCCC'><td><b>NAME</b></td><td><b>DATE</b></td></tr>";
    while($row = mysqli_fetch_assoc($result))
    {
        $name = $row['name'];
        //$password = $row['password'];
        $date = $row['dtime'];
        echo "<tr><td>$name</td><td>$date</td></tr>";
    }
    echo "</table>";
}
else
{
    echo "You must be logged in to view this page.<br/>";
    echo "<a href='login.php'>Login</a>";
}
?> 
2
Contributors
5
Replies
17
Views
2 Years
Discussion Span
Last Post by opelio4n
0

You can by adding style but using a class would be nicer, so you can then address any styling via CSS. You can also just use CSS on the a tag.

0

That's too vague. Show a complete working example (preferably online) and describe what you want, and what's not working.

0

What I want to do is to format the Anchor tag in the echo as a navigation bar

0

Thanks bro. have found another way to do it.

Compare this with the first code i display.
I include ul tag to it, then i gave the ul tag an id.

<?php
if(isset($_SESSION['valid']))
{   

    include("config.php");

    $result = mysqli_query($conn, "select * from users");
    ?>
    <ul id="bar">
    <?php
    echo "<li><a href='view.php'>View and Manage Users</a></li>";
    // echo "<br/>"; 
    echo "<li><a href='viewdept.php'>View and Manage Departments</a></li>";
    // echo "<br/>";
    echo "<li><a href='viewrep.php'>View and Manage Reports</a></li>";
    ?>
    </ul>
    <?php
    echo "<br/><br/>"; 
    echo "<b>Login List:</b><br/>";
    echo "<table width='35%'>";
    echo "<tr  bgcolor='#CCCCCC'><td><b>NAME</b></td><td><b>DATE</b></td></tr>";
    while($row = mysqli_fetch_assoc($result))
    {
        $name = $row['name'];
        //$password = $row['password'];
        $date = $row['dtime'];
        echo "<tr><td>$name</td><td>$date</td></tr>";
    }
    echo "</table>";
}
else
{
    echo "You must be logged in to view this page.<br/>";
    echo "<a href='login.php'>Login</a>";
}
?>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.