Jump to content

A-Z Anchor list


mithu_sree

Recommended Posts

I have some code like this for displayng an A-Z anchor table

[code]
function make_anchors_index() {
echo "<table class=\"anchor\">
<tr>";
for($i = 'A'; $i < 'Z'; $i++)
echo "<td><a href=\"#".$i."\">".$i."|</a></td>";
echo "<td><a href=\"#".$i."\">".$i."</a></td>";
echo "</tr></table><br />";
}
[/code]

This one produces a list of A-Z anchors
and when i mordified this to

[code]
function make_anchors_index() {
echo "<table class=\"anchor\">
<tr>";
for($i = 'A'; $i <= 'Z'; $i++)
echo "<td><a href=\"#".$i."\">".$i."|</a></td>";
echo "</tr></table><br />";
}
[/code]

produces
A|B|C....Y|Z|AA|AB|AC...
Why is this?

How can i display A|B|..Z list using only one
  echo "<td><a href=\"#".$i."\">".$i."|</a></td>";
statment mordifying only the for loop codition??
Link to comment
https://forums.phpfreaks.com/topic/30439-a-z-anchor-list/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.