What's wrong with this code? (Forwarding based on REQUEST_URI)

Discussion in 'PHP' started by lorocreative, May 28, 2008.

  1. #1
    <?php
    // take the request
    $request = strtolower($_SERVER[’REQUEST_URI’]);
    // see if it contains a tag
    if (strpos($request,”tag/”)) {
    // delete all before tag/
    $a = substr($request, strpos($request,”tag/”));
    // delete tag/
    $a = substr($a,4);
    }
    // we have the tag.
    $keyword = urldecode($a);
    }
    {
    header("Location: http://www.mysite.com/index.php?tag=$keyword");
    }
    ?>
    PHP:

     
    lorocreative, May 28, 2008 IP
  2. greatlogix

    greatlogix Active Member

    Messages:
    664
    Likes Received:
    13
    Best Answers:
    1
    Trophy Points:
    85
    #2
    What error you are getting? If this is complete code than you have extra curly braces

    $keyword = urldecode($a);
    }// no opening brace for it
    {// not required here
    header("Location: http://www.mysite.com/index.php?tag=$keyword");
    }// not required here
    PHP:
     
    greatlogix, May 28, 2008 IP