Jump to content

Recommended Posts

I got this code

<?php
$langFlag=false;
 $QueryString="";
  foreach ($_GET as $key => $value)
{ 
  $value = urlencode(stripslashes($value));
   if($QueryString!="")
   $QueryString .="&";
    
     $QueryString .= "$key=$value";
  
  
  }
  
$pageName=basename($_SERVER['PHP_SELF'] );

$pageFrURL ="../".$pageName."?".$QueryString;
$pageEnURL ="./english/".$pageName."?".$QueryString;
$pageRuURL ="../russian/".$pageName."?".$QueryString;

if($langFlag==false){
if($QueryString!=""){
$pageFrURL .="&";
$pageEnURL .="&";
$pageRuURL .="&";
}
}
?>

 

for multiple language site, french is default and is in the main folder, and other are in their respective folder. And i have a page named footer.php which i included in all page. While clicking on the respective flag link it goes to the same page which is being viewed.

 

My problem is that and "?" comes in the link when i switch page and i don't see the ? in the above code. I got some pages from where i have passed the value like mysite.com/abcd.php?page=abc but while switching ? comes in the end like mysite.com/abcd.php?page=abc?.

 

Will this extra "?" create a problem later or not, till now it is working but I am still in doubt ( i found this code in one site) ....

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/72905-can-you-explain-this-please/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.