Hi all
I've found this translation script on the web and it works properly .
This script doesn't depend on the database but on
the separated text file as you can see on the script .
But I have two questions ( to modify this script)
1- In case of the result or the requested word not found
How could I say ???? for example " Sorry this word doesn't exist"
2 - In case of the search place left empty .How could I say
for example " Please write a word "
<html dir="rtl">
<head>
<title><?print $word;?></title>
</head>
<body>
<form action="trans.php" method="GET">
<center>
<div style="border:1px solid;background-color:white;width:50%">
<?print $mor1?>
<input type="text" name="word"><br>
<br>
<input type="submit" value="translate">
</div>
</center>
</form>
<hr>
<?
if($GET[word])
{
$word = addslashes($GET[word]);
$filename = 'translation.txt';
$fp = fopen($filename, "r");
$data = fread($fp, filesize($filename));
$split_data = explode("\n", $data);
print "<div style=\"background-color:white\"> The definition of the word : $word<hr>";
for($i=0;$i < sizeof($split_data);$i++)
{
list($en, $ar) = explode("=>", $split_data[$i]);
if ($word === $en)
{
print $en." : <b>".$ar."</b><hr>\n";
break;
}
elseif(stristr($en,$word))
{
print $en." : <b>".$ar."</b><hr>\n";
}
}
}
?>
</div>
</body>
</html>
Thanks in advance .