Web Hosting Talk







View Full Version : simple help needed (in)


gargonzo
09-19-2002, 11:58 AM
http://www.mywebresources.co.uk/php/atozlinks.php

once clicked on a link from a-z it spits you back to the same page with the url like this:

http://www.mywebresources.co.uk/php/atozlinks.php?mylink=A

my question is.... I want to have links on each of those letters...

what do i have to do tomake it happen?

tia.

garz

Chr1s
09-19-2002, 07:09 PM
I'm not too sure what you mean but if you mean that you want each letter to have a URL that you specify here's what you can do:

chr($i) is the current letter.

so what you could do is put if-then-else or a switch( ) in between the loop like this:


<?
for ($i = 65 ; $i < 91 ; $i++)
{

if (chr($i) == "A") { $link = "my_a_link.php"; }
if (chr($i) == "B") { $link = "my_b_link.php"; } // etc...

echo ("<a href=$link>chr($i)</a>");
}
?>

gargonzo
09-20-2002, 10:33 AM
thanks for the quicl reply... was in front of the computer for tooo many hours yesterday :D

basically this is what i want.

a b c d e f g h i j k l m etc etc you click on the letter and it takes you to a page like


a.php
b.php
c.php

now on each of these pages there are links of people who's sites start with the letter the page represents:

aaa locksmith
alright lawn mowers

etctetc

instead of making each and every page for the letter pages i was trying to make myself less work.... I thought the above script would help save me some programming/scripting time..

thanks :D