Reply
Old 08-03-2004, 10:28 AM To PHP expert
Junior Talker

Posts: 1
Trades: 0
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 :

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 .
England is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Reply     « Reply to To PHP expert
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.10138 seconds with 13 queries