I am designing an internationalized website which has to have various languages stored in a table in mysql database. its very common, once the country flag or go button is clicked, i need a function that will get the languages from database and link it with the flag or go button,so that it will be displayed on my page.
here is my rough code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="noindex, nofollow" />
<style type="text/css">
div.container{
width:100%;
background-color:#e7ffcd;}
div.header{
background-color:#700000;
font-size:1.5em;
padding:0.4em 1.5em 0.4em 1.5em;
border-style:outset;}
div.nav{
background-color:#600000;
width:8em;
min-height:51.5em;
em;
float:left;}
div.content{
background-color:#383838 ;
margin-left:8em;
min-height:50em;
padding:0.4em 1.5em 0.4em 1.5em;
border-style:inset;
line-height:150%;}
div.footer{
background-color:#700000;
clear:left;
padding:0.4em 1.5em 0.4em 1.5em;
border-style:outset;}
div.nav-button{
margin:5% 5% 5% 15%;}
div.nav-button-mark{
background-color:#ffaaaa;
margin:5% 0% 5% 15%;}
</style>
<title>Framework: DIV based</title>
</head>
</style>
<title>Framework: DIV based</title>
</head>
<body>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="noindex, nofollow" />
<title> PHP & MySQL </title>
</head>
<body>
<center>
<div class="container">
<div class="header" align=center>
ADAPTIVE INTERNATIONALISED WEBSITE
<marquee direction="left" height="26" scrolldelay="90" scrollamount="6" behavior="alternate" loop="0";" id="Marquee1"><font style="font-size:13px" color="#00FF00" face="Arial Black"><i>University Library in Chinese, Japanese, French and Afrikaans.</i></font></marquee>
<div class="header" align=left>
<font style="font-size:15px" color="#FF" face="Tahoma">
<select name="Languages" size="1" id="Combobox1" onselect="ShowObject('Combobox1', 1);return false;">
<option type='selected' method='POST' name='$row[3]'>French</option>
<option type='selected' method='POST' name='$row[1]'>Chinese(simplified)</option>
<option type='selected' method='POST' name='$row[2]'>Japanese</option>
<option type='selected' method='POST' name='$row[0]'>English</option>
</select>
<input type="submit" id="Button1" name="Button1" value="GO" style="postion:absolute;left:82px;width:35px;height:24px;font-family:Tahoma;font-size:13px;z-index:0">
<?php
/**
* Just add this in your page where you
* want the date/time to appear
*
* For more configuration options look
* in the PHP manual at [url]http://uk2.php.net/date[/url]
*/
// Displays in the format Saturday, November 22, 2003 11.38
echo date("l, F d, Y H:i " ,time());
?>
</font>
</div>
<div class="nav">
<!-- You may want to include the php echo $_SERVER['PHP_SELF'] so that one has the
full URL rather than leave it to the Browser to complete -->
<div class="nav-button"><a href='?page=home'>home</a></div>
<div class="nav-button"><a href='href='?page=page1'>gallery</a></div>
<div class="nav-button"><a href='?page=page2'>business</a></div>
<div class="nav-button"><a href='?page=page3'>contact us</a></div>
</div>
<div class="content">
<?php
"../../group01.php" ;
$mysql_hostname="host";
$mysql_username="user";
$mysql_password="pass";
$link_id_resource=mysql_connect($mysql_hostname, $mysql_username, $mysql_password);
if($link_id_resource === false){exit("Cannot make connection to the MySQL server");}
mysql_query("SET NAMES 'utf8';", $link_id_resource); //utf8 stuff
// Selecting a MySQL database
$mysql_database="group05";
$database_selected=mysql_select_db($mysql_database,$link_id_resource);
mysql_query("SET NAMES 'utf8';", $link_id_resource); //utf8 stuff
echo '<h2>• UNIVERSITY LIBRARY •</h2>';
$sql_query = "SELECT Chinese FROM `Table`";
$result=mysql_query($sql_query);
while ($row=mysql_fetch_row($result)){
echo $row[0]."<br/>";
};
mysql_close($link_id_resource);
?>
</div>
<div class="text">
<font style="font-size:11px" color="#FF" face="Tahoma">
© 2010 GroupOne. All right reserved
</font>
</div>
</div>
</body>
</html>
Any urgent assistance will be appreciated as i need to submit it soon.
Thanks
MOD EDIT: When posting PHP code, please use the board's [noparse]
..
[/noparse] bbcode tags as they make your code much easier to read and analyze. You might want to remove your SQL login credentials next time, too. 😉