Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6353169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:21:51+00:00 2026-05-24T22:21:51+00:00

I use this simple module included in my header to let the user change

  • 0

I use this simple module included in my header to let the user change language of the site

 <div class="left first">
   <a href="' . $_SERVER['REQUEST_URI'] . $linkParam . 'sv">
    <img src="bilder/sv.png" alt="SV" />
   </a>
</div>


<div class="left"><img src="bilder/eng.png" alt="ENG" /></div>

The language available for change is a link that send the lang param via a http request and thus set the language session. Before I always sended the user to index.php but I would like to make it possible to change language throughout the site and stay on the page.

Since some pages has http params which need to remain I use this solution to determine if the lang param should be ?lang=...or &lang=...

if($_SERVER['REQUEST_URI'] != $_SERVER['PHP_SELF']){

            $linkParam = '&lang=';

        }else{

            $linkParam = '?lang=';

        }

It is working fine with some test but will this consistently work to determine if the url already has ?param and set the lang-param?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T22:21:53+00:00Added an answer on May 24, 2026 at 10:21 pm

    Take a look at the http_build_query function, perhaps this will help you. You could do the following:

    $aGet = $_GET;
    $aGet['lang'] = $sLanguage;
    $sQueryString = http_build_query($aGet);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use this code: http://blogswizards.com/plugin-development/sliding-boxes-and-captions-with-jquery On a simple gallery site I am building. Specifically
In order to delete all .svn files/folders/subfolders in myfolder I use this simple line
I know how to get the scrollTop of a page, I use this simple
I have developed a simple library in Ruby and need to use this in
I've got this simple Perl script: #! /usr/bin/perl -w use strict; use Data::Dumper; my
Simple. If I use: public void Add(params int[] values) Then I can use this
This question is simple. What function would I use in a PHP script to
For a very simple profiling I use microtime() like this: $now = microtime(); for
For more information see this Example use strict; use warnings; use CGI::Simple; use DBI;
Is it possible to use something like this wrapper with fluent configuration? http://jeffreypalermo.com/blog/use-this-nhibernate-wrapper-to-keep-your-repository-classes-simple/ If

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.