Jump to content


If-Else Linking.

  • Please log in to reply
3 replies to this topic

#1 DantePhlegethon

  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 09 September 2006 - 07:52 PM

If-Else Linking.

Hello, I am completely new to this forum so you must forgive me if this topic has been covered before. Thank you.

I am trying to set up a link that changes its destination depending on what month it is. Its not exactly a calendar that I am looking for, it’s simply a link to different pages.

I am also “fairly new” to PHP so any help you can give or direction you can point me in would be greatly appreciated.

All I need is a Text or Graphic Link that:

• Depending on what month it is, displays a different page.
• Tracks the month with a PHP Variable.

#2 redarrow

  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 09 September 2006 - 08:05 PM

This will do all the months in the year.

1 make a folder called images.

2. make images a - i . gif

good luck.



























echo "<img src='$pic'></img>";

Wish i new all about php DAM i will have to learn

#3 AndyB

  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 09 September 2006 - 08:23 PM

$month = strtolower(date("F")); // gets the lowercase month name for the current date
echo "<a href='". $month. ".php'><img src='images/". $month. ".gif'"></a>";

If the month is September, for example, then the link will go to september.php and the clickable image in the link will be september.gif ... you get to create all the images and .php files yourself.

Is that sort of what you were looking for?
Legend has it that reading the manual never killed anyone.
My site

#4 DantePhlegethon

  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 10 September 2006 - 03:08 AM

Thank you for your help, this is exactly what I was looking for.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users