$variable in hyperlink?

Discussion in 'PHP' started by Alexj17, May 4, 2008.

  1. #1
    Hi All

    Just a quick question...... i want to inclue a $variable into a hyperlink. I am makin a holiday website which has different home pages for the different destinations. ie. Liverpool_home.php, London_home.php, Paris_home.php.

    i want to be able to use the same navigation link bar and put a variable in the home link ie...

    www.mydomain.com/"$destination"_home.php

    if i just use $destination and put the _home.php after it it will look for a variable called $destination_home which is not what i want.

    How can i sort this?

    AJ
     
    Alexj17, May 4, 2008 IP
  2. danzor

    danzor Peon

    Messages:
    208
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #2
    echo 'www.domain.com/' . $destination . '_home.php';

    echo "www.domain.com/$destination_home.php";

    Both will work.
     
    danzor, May 4, 2008 IP
  3. Alexj17

    Alexj17 Member

    Messages:
    173
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    28
    #3
    Worked Perfect Thanks !!!

    Didnt even try the second way as this way worked fine.

    Cheers Again

    AJ
     
    Alexj17, May 4, 2008 IP