Jump to content

Can you explain this please ???


~n[EO]n~

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.