Any ideas how I do this?

Nor

Nor

Associate
Joined
27 May 2003
Posts
1,861
Hi lads. Doing a little website. Want to have a section with the letters A-Z and a piece of text underneath. When you click one of the letters the text underneath changes. A will bring up a something to do with A, B will bring up something to do with B etc.

Any ideas how I might do it? Ideally without javascript. Many thanks in advance.
 
If you are not using javascript then you will probably need to use something like php and add the parameter on to the url i.e.

www.domain.com/a/
www.domain.com/b/

For each letter as a parameter then you can include a different file or section of code. It's a pretty bad way of doing it though if you have to add 26 sections!

Another way to do it would be to have anchors within the page pointing to every letter section. Then on the click of each letter the relevant anchor is scrolled to. You could use javascript to add scroller effects.
 
Thanks Ringo. Space is restricted, so can't go with anchors. PHP may be the way to do it with the link changing the include I guess, but I'm no exactly sure how to go about doing that.
 
Sorry im typing this from train on mobile broadband so will keep it brief.

Basically what you want to do if doing it the PHP way it to get the value of your $_GET parameter. Make sure to sanitize this value.

Then you can use a case statement i.e.

case 1
do something
break
case 2
do something
break
...
etc

UNder the do something bit you could include a different file or else echo out different content.

Not a good explanation but doing it quick as i said.
 
Back
Top Bottom