GAH! Javascript = surrender. It defeats one of the purposes of a serverside language, i.e. 100% certainty.
There is a flaw in the code somewhere. Why don't you try posting all the applicable code in one reply? I have done a lot of links just like this and it's a great technique to automate an unlimited menu of pages. I did a page where the database had articles written, and
php automatically generated the new link and page using your exact code, i.e.
href="...?id=mysqlid" as the pattern link and
$id=$_GET['id'] on the new page.