1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

$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