Problem with duplicate $_GET['lang'] variable in URL

Discussion in 'PHP' started by ghogilee, Feb 3, 2009.

  1. #1
    Hi all,
    I'm working on a multilingual site for the first time. And I have problem with duplicate $_GET['lang'] variable in URL. I don't have a clue how to remove it from the URI if $_GET['lang'] is already set.

    This is my url handling code:

    if ( isset( $_SERVER['REQUEST_URI'] ) ) {
    	$uri = $_SERVER['REQUEST_URI'];
    } else {
    	$uri = $_SERVER['SCRIPT_NAME'];
    	if ( isset( $_SERVER['QUERY_STRING'] ) && !empty( $_SERVER['QUERY_STRING'] ) ) {
    		$uri .= '?' . $_SERVER['QUERY_STRING'];
    	}
    }
    $_SERVER['REQUEST_URI'] = $uri;
    PHP:
    I want let user change the language without leaving the current page.
    So pleaaase help.
    Thanx in advance
     
    ghogilee, Feb 3, 2009 IP
  2. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #2
    first do a debug

    print_r($_GET);
     
    Kaizoku, Feb 3, 2009 IP