in reply to Anchor CGI output

This is totally untested. Shooting from the hip here.

Have you tried to put the anchor in the referencing URL?
Like: http://yoursite/yourscript#anchor?yourparameters

"Livet är hårt" sa bonden.
"Grymt" sa grisen...