I've got a script that dynamically generates anchors, but only the anchor value is echoed. I don't know if that makes a difference, but I know dynamic anchors are possible.
This loop outputs alphabetical anchors along with plan names that start with the letter in the current iteration:
<?
// Create alphabet array.
$alphabet = array(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z);
// List each array value and advance the cursor
while (list ($key, $val) = each ($alphabet)) {
?>
<tr>
<td><a name="<? echo $val ?>"><? echo $val ?</a></td>
</tr>
<?
// Execute select
$rows = odbc_exec ($conn, "SELECT CONTRACT_ID, PLAN_NAME FROM UNITED.PLAN_CONTRACT WHERE PLAN_NAME
LIKE '$val*' AND ACTIVE = '-1' ORDER BY PLAN_NAME");
// Echo NAME. Echo PLAN_ID in URL data
while (odbc_fetch_row($rows)) {
$PLAN_ID = odbc_result($rows, 1);
$NAME = odbc_result($rows, 2);
?>
<tr>
<td><a href="3pdata.html?PLAN_ID=<? echo $PLAN_ID ?>"><? echo $NAME ?></a></td>
</tr>
<?
}
}
?>