building a link problem

Discussion in 'PHP' started by c00sm1n, Apr 2, 2009.

  1. #1
    i want to make somethink like this , i have 4 filter for exemple , first filter have the variables (blue, green,red) , second (10cm,20cm,30cm) ..., and if i select the second filter to 30cm the link looks like ..script.php?filter=30cm/ , if i want the first filter and to keep the second the link should look like this script.php?filter=blue/30cm/ .. if i want to select the third filter and to keep the first and the second the link should look like this script.php?filter=blue/30cm/thirdfilter/ (blue - first filter, 30cm - second filter, thirdfilter - third filter) and so long .. and the option to remove a filter , if i want to remove the second filter the link should look like this script.php?filter=blue/thirdfilter/ , basicly i dont know how to make the link and to remove a variable from link, thanks for helping me and sorry for my english.
     
    c00sm1n, Apr 2, 2009 IP
  2. ultrasonic

    ultrasonic Peon

    Messages:
    30
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    if(IsSet($filter1)){
    $filter1 = $filter1 . "/";
    }
    if(IsSet($filter2)){
    $filter2 = $filter2 . "/";
    }
    if(IsSet($filter3)){
    $filter3 = $filter3 . "/";
    }

    $link = "script.php?filter=" . $filter1 . $filter2 . $filter3;
     
    ultrasonic, Apr 3, 2009 IP
  3. bartolay13

    bartolay13 Active Member

    Messages:
    735
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    98
    #3
    try switching
     
    bartolay13, Apr 3, 2009 IP
  4. c00sm1n

    c00sm1n Member

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #4
    bartolay13 can u do a small exemple for me please ?
     
    c00sm1n, Apr 3, 2009 IP