disable a href links using PHP

css, php

Solution

try this

if($php_var == "no")
{
    echo '<a href="javascript:void(0);">Your Text For Link</a>';
} 
else
{
    echo '<a href="your link">Your Text For Link</a>';
}

user `javascript:void(0);` for no redirection. this will maintain your css for link like others but when you click it won't redirect.

Problem

I have a page with a menu on for logged in users i am including this page on all the other pages in my site but i don't want users that are NOT logged in to be able to click the links How can I disable all the links on that page if a PHP variable `= 'no'` i know i can use ``` if($php_var == 'no') { //do something here } ``` but I'm not sure how to disable the links? Is there any way using CSS or Javascript to disable links?

Original source