I have a website that has 5 different languages and when choosing a language the text of the page changes! For this I did a function:
<script type="text/javascript">
function submitForm() {
var thelang = document.getElementById('lang').options[document.getElementById('lang').selectedIndex].value;
window.location.href = window.location.pathname +'?lang=' + thelang;
}
</script><br/>
The problem is that I now have two id
different for this page, and I would like to know how I also include id
in this function.
For example the url should look something like this:
localhost:8080/.../index.php?id=1&&lang=pt
, but since I could not pass id
to variable, now the pages are no longer translated. id
I search via GET
if (isset($_GET['id']) && !empty($_GET['id']))
{
$id=$_GET['id'];
$id=mysqli_real_escape_string($link,$id);
$query="SELECT * FROM local where local_id='".$id."'";
$result=mysqli_query($link,$query);
while ($row=mysqli_fetch_array($result)) {
if ($row['local_id'] == 1)
{
?> //AQUI FICA O HTML <?php } ?>
The languages are chosen through a select, what is happening is that you can not load anymore, I can only refresh the page manually, changing the URL ...