Dear All,
I am very happy to be here. I have got alots help from this forum.
I don't know how to show my search result on the same page.
My Code
index.php
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script language="javascript" type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script language="javascript" type="text/javascript" src="jquery.jSuggest.1.0.js"></script>
<title>Simple English Online Dictionary</title>
<script type="text/javascript">
$(function($){
$("#searchterm").jSuggest({
minchar: 3,
zindex: 20000,
delay: 2500,
loadingImg: 'ajax-loader_green1.gif',
loadingText: 'Searching...',
autoChange: true,
url: "suggestion.php?",
type: "GET",
data: "searchterm",
});
})(jQuery);
</script>
</head>
<body>
<center>
<p>You can search the meaning of word.</p>
<div id="stylized">
<form action="search.php" method="GET">
<b>English Word :</b>
<input name="searchterm" type="text" id ="searchterm" />
<input type=submit value="search">
</form>
</div>
</body>
</html>
Search.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Simple Online Dictionary</title>
<script type="text/javascript" src="jquery-1.2.6.min.js"></script>
<script type="text/javascript" src="jquery.dbPopWin-1.0.0.js"></script>
</head>
<body>
<script type="text/javascript">
$(document).ready(function()
{
$('a[rel="dbPopWin"]').click(
function()
{
return $.dbPopWin( $(this).attr('href'), { dbPopWinWidth: 800, dbPopWinHeight: 600 } );
}
);
}
);
</script>
<?
$db_name="mydic";
trim($searchterm);
if (!$HTTP_GET_VARS["searchterm"])
{
echo "You haven't entered any word to search.Please, go back and entered it.";
exit;
}
$searchterm = addslashes($searchterm);
require("dict.php");
if (!$db)
{
echo "Error. Can't connect to database.Please try later";
}
mysql_select_db($db_name);
$query = "select * from words where engword like '".$HTTP_GET_VARS["searchterm"]."%' order by engword";
$result = mysql_query($query);
$num_results = mysql_num_rows($result);
echo "<ul>";
for ($i=0; $i <$num_results; $i++)
while($data = mysql_fetch_array($result))
{
echo "<li>{$data['engword']}</li>";
echo "<a href=\"http://localhost/dict/audio_en/{$data['engword']}.mp3\" title=\"open the audio file for the word {$data['engword']} \"rel='dbPopWin'><img src='audio.gif' alt = open the audio file for the word {$data['engword']} ></a>";
echo " ";
echo (stripslashes($data["mword"])). "</li>";
echo " </br>";
echo " </br>";
}
echo "</ul>";
mysql_close($db);
echo "<br><br><a href='index.php'>search another word</a>";
?>
</body>
</html>
Could you give me please a tip on it.
Many thank in advance.
regards,
saya