Hi all
Imagine that there are many words stored in ( translation.txt ) file
according to the shown script . for example :
paper
page
pen
pilot
.
.
.
until now every thing working properly . but when I write the letter ( p ) only on search
field and press translate button all words on the stored file which begin with the letter
(p) are shown or ( printed ) !! ((and here is the problem !!!!!!!!)).
I don't want all words which begin with the letter (P) to be printed but print only
the requied word . for axample if ask about the word ( page ) I want it to print the
definition of the word ( page ) only not the definition of the word ( page ) and ( paper)
not both of them .
How could I solve this problem ?????? What change must be made ????
<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 for all in advance .