You are here: Variables being APPENDING in URL and Address bar. Why ? « PHP Programming Language « IT news, forums, messages
Variables being APPENDING in URL and Address bar. Why ?

Posted by david.hunter on 03/07/06 21:35

Hi - my site is bilingual.
I have two language files that look like this :
en.inc
define(HELLO, 'Hello');
fr.inc
define(HELLO, 'Bonjour');

Then my php/html looks like this:
<h3><?php echo HELLO ?></h3>

In each page I check and/or set the language :
index.php :
$lang='en';
require('languages/set_language.php');

set_language.php :
if (isset($_GET['lang'])) {
$lang = $_GET['lang']; }
require("{$lang}.inc");

I have a hyperlink in the footer so that the user can toggle between
languages. The toggle works, but the language parameter is being
APPENDED into the URL and in the address bar of the browser - like this
:
&lang=fr&lang=en&lang=fr&lang=en&lang=fr

Why is this happening and how can I stop it ?

Here is my footer.php code :
<a href="http://website.com/<?php echo
$_SERVER['SCRIPT_NAME'] ?>?<?php echo $_SERVER['QUERY_STRING']
?>&lang=<?php echo $toggle ?>"><?php echo MENU_TOGGLE ?></a>

THANK YOU!

I know it's not practical for people to be going back and forth between
languages - but this problem is still annoying the heck out of me!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация