im having a variable that is containing some links. Now i want to check that which link is clicked and hae to remove its anchor tag so that people can come to know that which tab has been clicked.
this is the example of the data :-
<a href="#" onclick="sort_data('All','all')">All</a> | <a href="#" onclick="sort_data('Diversified','1')">Equity</a> | <a href="#" onclick="sort_data('Liquid','1')">Liquid</a> | <a href="#" onclick="sort_data('Sector','1')">Sector</a>
Now what im trying to do is that i see that which tab is cliked in the js function and then using php to replace that particular anchor tag.But its not running fine.
$links='<a href="#" onclick="sort_data('All','all')">All</a> | <a href="#" onclick="sort_data('Diversified','1')">Equity</a> | <a href="#" onclick="sort_data('Liquid','1')">Liquid</a> | <a href="#" onclick="sort_data('Sector','1')">Sector</a>
';
if(preg_match('/<A HREF="#" onclick="(.*?)>Equity/',$links))
{
echo preg_replace('/<A HREF=(.*?)>Equity/','Equity',$links);
}
This is replacing everything written before Equity while i want that only Equity's anchor tag should be removed and else should remain as it is. What im doing wrong here and if theres some better way to do this then i would appreciate for telling me.