My page is split into 2 divs - #content and #sidebar and I'm splitting this into 2 php pages.

What I'd like to do is insert a function into #sidebar (sidebar.php) where it will scan #content (content.php) for a
HTML Code:
<a name="#1"></a>
tag and then output a
HTML Code:
<a href="1">1</a>
into sidebar.php

Can anyone help start me off on this - I know I need to put the results into an array and then output them somehow, but I'm not sure how to correctly scan content.php. (By the way content.php will just be a static page and not contain any dynamic content).