Hi Phil,
Your problem here is that the counter page is not generating valid ECMAscript (aka Javascript) to insert elements into the outer page.
Oh dear... sounds like this little project is a bit more complex than I thought.
There are a couple of solutions that spring to mind:
[1] Counter page generates valid ECMAscript, eg: document.write(counter);
[2] Counter page generates valid HTML, which you include in an IFRAME:
<html><body>$counter</body></html> main page contains: <iframe src="...counter.php?page=main"/>
Thanks for those helpful suggestions, and the suggestions of other ALUGers. I will try a few experiments along the lines of what you suggest.
[3] Since it's PHP, just include the counter page in all other pages? This does mean you cannot have static HTML pages, everything must be a PHP.
Unfortunately some of the pages which I wish to use this remote PHP script are hosted on "free" webhosts and the webspace they provide is very basic and not PHP/SQL enabled. Hence why I want to host the script on my main PHP enabled webspace but to sometimes access it from basic HTML (not PHP enabled) webspace pages.
Thanks to yourself, Brett and Dave I now have some ideas for the way forward.
Sagr.