Named anchors are a HTML thing and have nothing to do with PHP. You can't "make them" in PHP -- you can only make PHP output the HTML to make them. Maybe if you could show us the code you've tried to use.
<a href="<? $_SERVER[PHP_SELF]; ?>#whatever">This will go to 1st tag with that name/id!</a> .... <table id="whatever"><tr>......
<a name="red">Red: TXT GOES HERE TXT GOES HERE</a>