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.

dynamic links

Discussion in 'HTML & Website Design' started by cordas, Dec 6, 2008.

  1. #1
    Hey,
    i am having a hard time finding info on how to make dynamic links like this:
    http://www.example.com/redirect.php?c=ECC

    does anyone know how to make them or point me to the right direction , please

    any help appreciated...
     
    cordas, Dec 6, 2008 IP
  2. tobydawson13

    tobydawson13 Active Member

    Messages:
    645
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    60
    #2
    Ok to start with you have posted in the wrong forum. This forum is for HTML and Website Design, you should have posted in the PHP forum. But don't worry :)

    I think this is what you want.

    Add this code to your redirect.php page.

    <? 
    if ($_GET[c] == "page1")
    {
    echo "This is page 1.";
    
    }
    elseif ($_GET[c] == "page2")
    {
    echo "This is page 2.";
    }
    else
    {
    echo "You cannot access this page directly!";
    }
    ?>
    Code (markup):
    If a visitor visits http://www.example.com/redirect.php?c=page1
    They will receive the message "This is page 1."

    If a visitor visits http://www.example.com/redirect.php?c=page2
    They will receive the message "This is page 2."

    If a visitor visits http://www.example.com/redirect.php
    They will receive the message "You cannot access this page directly!"

    Hope this helps, anymore questions feel free to PM me :D
     
    tobydawson13, Dec 6, 2008 IP
    dejangex likes this.
  3. dejangex

    dejangex Peon

    Messages:
    113
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Say you have a page "domain.com/page.php"

    Now you want to send some values to it, say item_number which is 734.

    You link would be domain.com/page.php + ? + item_number + = + 734
    giving you domain.com/page.php?item_number=734
    If you want to pass more than one value use "&" like this: item_number=734&customer=John&price=7

    Now in the php code of the page if you want to get those values do this:

    <?php
    $item_number = $_GET['item_number']; //Will be 734
    $customer = $_GET['customer']; //Will be John
    $price = $_GET['item_number']; //Will be 7
    ?>
    PHP:
    After you get those values, you would need to compare them to something, or display them to the user. Also you can check if they are empty (if user enters "item_number=&customer=&price=")
     
    dejangex, Dec 8, 2008 IP
  4. cordas

    cordas Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    this is almost the thing i am looking for...

    one more question.
    what if i want "page 1" to redirect to google.com?
     
    cordas, Dec 15, 2008 IP
  5. cordas

    cordas Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    cordas, Dec 23, 2008 IP
  6. FMossberg

    FMossberg Banned

    Messages:
    32
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    You've got to have multiple values set on the page, for example in a form.
     
    FMossberg, Dec 23, 2008 IP
  7. planemaniac

    planemaniac Peon

    Messages:
    49
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    If you want page1 to redirect to google.com, in the bit of code about page1, you do this:

    
    if ($_GET[c] == "page1")
    {
    // this is still page 1
    
    header('Location:http://www.google.com'); // This redirects the user
    
    }
    
    PHP:
    Hope that helps
     
    planemaniac, Dec 23, 2008 IP
  8. cordas

    cordas Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    cordas, Dec 24, 2008 IP
  9. allodium

    allodium Peon

    Messages:
    44
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    if ($_GET['c'] == "page1" && $_GET['customer'] == "John")
    {header('Location:[url]http://www.google.com');[/url] }
    if ($_GET['c'] == "page1" && $_GET['customer'] == "Mark")
    {header('Location:[url]http://www.yahoo.com');[/url] }
    PHP:
     
    allodium, Dec 24, 2008 IP