Hi
I am trying to use an IMAGE as a button to call a set of variables. Particularly, I am trying to switch languages by clicking on a flag image. In order to do so, the language is a variable. The action should provide a value for the main variable that call subordinated variables. However, it does not work, when trying to use the IMAGE BUTTONS the value of the subordinated variables do not appear in their place, and the buttons do not provide any value to the main variables. I leave the generic code bellow:
<html>
<head>
<title>Document with no title</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<?php
$url = $_SERVER['PHP_SELF'];
if(empty($_GET['ln'])){
header("Location:index.php?ln=en");
}
//Variables in English go here
if($_GET['ln'] == "en"){ //It takes the variable set depending on the selected language
$button1 = "Link1";
$button2 = "Link2";
$button3 = "Link3";
$button4 = "Link4";
$button5 = "Language";
$txt1 = "Main text";
}
//Variables in Spanish go here
if($_GET['ln'] == "sp"){
$button1 = "Enlace1";
$button2 = "Enlace2";
$button3 = "Enlace3";
$button4 = "Enlace4";
$button5 = "Idioma";
$txt1 = "Texto principal";
}
?>
</head>
<body>
<div align="center">
<table width="760" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="760" height="159" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr align="center" valign="middle" bgcolor="#FFFFFF">
<td height="127" colspan="7" align="center" valign="middle"><!--ROOM FOR IMAGE AS SITE HEADER--> <td>
</tr>
<tr>"><!--This row is for the navigation bar-->
<td width="140" height="32" align="center" valign="middle" bgcolor="#000000"><strong><font color="#FF0000" face="Arial, Helvetica, sans-serif">
<?php $ln = $_GET['ln']; echo "$button1"; ?>
</font></strong></td>
<td width="140" align="center" valign="middle" bgcolor="#000000"><strong><font color="#FF0000" face="Arial, Helvetica, sans-serif">
<?php $ln = $_GET['ln']; echo "$button2"; ?>
</font></strong></td>
<td width="140" align="center" valign="middle" bgcolor="#000000"><strong><font color="#FF0000" face="Arial, Helvetica, sans-serif">
<?php $ln = $_GET['ln']; echo "$button3"; ?>
</font></strong></td>
<td width="140" align="center" valign="middle" bgcolor="#000000"><strong><font color="#FF0000" face="Arial, Helvetica, sans-serif">
<?php $ln = $_GET['ln']; echo "$button4"; ?>
</font></strong></td>
<td width="140" align="center" valign="middle" bgcolor="#000000"><strong><font color="#FF0000" face="Arial, Helvetica, sans-serif">
<?php $ln = $_GET['ln']; echo "$button5"; ?>
</font></strong></td>
<td width="30" align="center" valign="middle" bgcolor="#000000"><!--IMAGE BUTTON: It will call the English language--> <input type="image" name="ln" img src="images/gb.gif" width="16" height="11" onclick="submit()" value="sp"<?php /* To call the variable in English */ if($_GET['ln']=="en"); ?>/>
</td>
<td width="30" align="center" valign="middle" bgcolor="#000000"><!--IMAGE BUTTON: It will call the Spanish language--> <input type="image" name="ln" img src="images/es.gif" width="16" height="11" onclick="submit()" value="sp"<?php /* To call the variable in Spanish */ if($_GET['ln']=="sp");?>/>
</td>
</tr>
</table></td>
</tr>
<tr>
<td height="419" valign="top"><br><!--ROOM FOR THE MAIN TEXT-->
<?php $ln = $_GET['ln']; echo "$txt"; ?>
</td>
</tr>
</table>
</div>
</body>
</html>
The code works if we substitute the IMAGE BUTTONS for a LIST FORM. You can check it by changing the NAVIGATION BAR code for cell with button5 and the images for this:
<td width="100" align="center" valign="middle" bgcolor="#000000"><strong><font color="#FF0000" face="Arial, Helvetica, sans-serif">
<?php $ln = $_GET['ln']; echo "$botton5"; ?>
</font></strong></td>
<td width="100" align="center" valign="middle" bgcolor="#000000"><strong><font color="#FF0000" face="Arial, Helvetica, sans-serif">
<form action="<?php echo($url);?>?ln=$ln" method="get" >
<select onchange="this.form.submit()" name="ln">
<option value="sp"<?php if($_GET['ln']=="sp"){echo 'selected="selected"';}?>>Español</option>
<option value="en"<?php if($_GET['ln']=="en"){echo 'selected="selected"';}?>>English</option>
</select>
</form>
</font></strong></td>
</tr>
Can anybody help me to fix the code?
Thanks in advance.
Ciao.
I am trying to use an IMAGE as a button to call a set of variables. Particularly, I am trying to switch languages by clicking on a flag image. In order to do so, the language is a variable. The action should provide a value for the main variable that call subordinated variables. However, it does not work, when trying to use the IMAGE BUTTONS the value of the subordinated variables do not appear in their place, and the buttons do not provide any value to the main variables. I leave the generic code bellow:
<html>
<head>
<title>Document with no title</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<?php
$url = $_SERVER['PHP_SELF'];
if(empty($_GET['ln'])){
header("Location:index.php?ln=en");
}
//Variables in English go here
if($_GET['ln'] == "en"){ //It takes the variable set depending on the selected language
$button1 = "Link1";
$button2 = "Link2";
$button3 = "Link3";
$button4 = "Link4";
$button5 = "Language";
$txt1 = "Main text";
}
//Variables in Spanish go here
if($_GET['ln'] == "sp"){
$button1 = "Enlace1";
$button2 = "Enlace2";
$button3 = "Enlace3";
$button4 = "Enlace4";
$button5 = "Idioma";
$txt1 = "Texto principal";
}
?>
</head>
<body>
<div align="center">
<table width="760" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="760" height="159" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr align="center" valign="middle" bgcolor="#FFFFFF">
<td height="127" colspan="7" align="center" valign="middle"><!--ROOM FOR IMAGE AS SITE HEADER--> <td>
</tr>
<tr>"><!--This row is for the navigation bar-->
<td width="140" height="32" align="center" valign="middle" bgcolor="#000000"><strong><font color="#FF0000" face="Arial, Helvetica, sans-serif">
<?php $ln = $_GET['ln']; echo "$button1"; ?>
</font></strong></td>
<td width="140" align="center" valign="middle" bgcolor="#000000"><strong><font color="#FF0000" face="Arial, Helvetica, sans-serif">
<?php $ln = $_GET['ln']; echo "$button2"; ?>
</font></strong></td>
<td width="140" align="center" valign="middle" bgcolor="#000000"><strong><font color="#FF0000" face="Arial, Helvetica, sans-serif">
<?php $ln = $_GET['ln']; echo "$button3"; ?>
</font></strong></td>
<td width="140" align="center" valign="middle" bgcolor="#000000"><strong><font color="#FF0000" face="Arial, Helvetica, sans-serif">
<?php $ln = $_GET['ln']; echo "$button4"; ?>
</font></strong></td>
<td width="140" align="center" valign="middle" bgcolor="#000000"><strong><font color="#FF0000" face="Arial, Helvetica, sans-serif">
<?php $ln = $_GET['ln']; echo "$button5"; ?>
</font></strong></td>
<td width="30" align="center" valign="middle" bgcolor="#000000"><!--IMAGE BUTTON: It will call the English language--> <input type="image" name="ln" img src="images/gb.gif" width="16" height="11" onclick="submit()" value="sp"<?php /* To call the variable in English */ if($_GET['ln']=="en"); ?>/>
</td>
<td width="30" align="center" valign="middle" bgcolor="#000000"><!--IMAGE BUTTON: It will call the Spanish language--> <input type="image" name="ln" img src="images/es.gif" width="16" height="11" onclick="submit()" value="sp"<?php /* To call the variable in Spanish */ if($_GET['ln']=="sp");?>/>
</td>
</tr>
</table></td>
</tr>
<tr>
<td height="419" valign="top"><br><!--ROOM FOR THE MAIN TEXT-->
<?php $ln = $_GET['ln']; echo "$txt"; ?>
</td>
</tr>
</table>
</div>
</body>
</html>
The code works if we substitute the IMAGE BUTTONS for a LIST FORM. You can check it by changing the NAVIGATION BAR code for cell with button5 and the images for this:
<td width="100" align="center" valign="middle" bgcolor="#000000"><strong><font color="#FF0000" face="Arial, Helvetica, sans-serif">
<?php $ln = $_GET['ln']; echo "$botton5"; ?>
</font></strong></td>
<td width="100" align="center" valign="middle" bgcolor="#000000"><strong><font color="#FF0000" face="Arial, Helvetica, sans-serif">
<form action="<?php echo($url);?>?ln=$ln" method="get" >
<select onchange="this.form.submit()" name="ln">
<option value="sp"<?php if($_GET['ln']=="sp"){echo 'selected="selected"';}?>>Español</option>
<option value="en"<?php if($_GET['ln']=="en"){echo 'selected="selected"';}?>>English</option>
</select>
</form>
</font></strong></td>
</tr>
Can anybody help me to fix the code?
Thanks in advance.
Ciao.