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>";
}
?> 

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.

have tried it but is not formatting the way i want

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

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

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>";
}
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.