Hi,
I am having an odd problem here.
I have done search form for chinese characters before and it works, but for some reason it doesn't work for this one.
this is what i have.
<html>
<head>
<title>Title</title>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
</head>
<body>
<?
if(!isset($_POST['key'])){
?>
<center>
<h1>Header 1</h1>
<p>
<form method=post action=thisfile.php>
<table>
<tr><td align=center>Search</td></tr>
<tr><td><input type=text name=key> <input type=submit value=Search></td></tr>
</table>
</form>
</center>
<?
}
else{
mysql_connect("mysqlserver", "myusername", "mypassword");
mysql_select_db("mydatabase");
$mysqlStr = "SELECT * FROM table1 WHERE mykey1 LIKE '%{$_POST['key']}%' ";
$r = mysql_query($mysqlStr);
if(mysql_num_rows($r) > 0){
$x = 0;
while($row = mysql_fetch_row($r)){
foreach($row as $i => $value){
$column = mysql_field_name($r, $i);
$data["$column"] = $value;
$arr[$x] = $data;
}
$x++;
}
}
else{
?>
<center><font size=4 color=red><b>No result found for <?echo $_POST['key'];?></b></font></center>
<?
}
for($i = 0; $i < $x; $i++){
echo "<center><table>";
echo "<tr><td align=center class=key1>{$arr[$i]['mykey1']}</td></tr>";
echo "<tr><td> </td></tr>";
echo "<tr><td align=left><table border=0 cellspacing=0 cellpadding=0><tr><td class=key2>MyKey2</td><td> : </td><td class=key2>{$arr[$i]['mykey2']}</td></tr><tr><td class=key3>MyKey3</td><td> : </td><td class=key3>{$arr[$i]['mykey3']}</td></tr></table></td></tr>";
echo "</table><p><br><p></center>";
}
}
?>
for some reason, if i key in ascii letters, i can search the database, but if i key in any chinese characters, it will return 0 result, but no error. If i hard code the chinese character in, i can get the expected result.
can someone please tell me what's wrong with the code?
Another problem is, how do i make the browser automatically display it as chinese. I though the <meta> tag that i have should make it do that.
thanks
Kel