may_bailey
08-24-2009, 11:47 AM
Hi All,
I have been in design world more than 5 years but I'm newbee in coding. And This time I want to prepare a dictionary for Italian - Turkish and Turkish - Italian. I prepared a simple database in phpmyadmin as an example to see the result (it has almost 10 words) and found some php codes to get the informations from the database.
This is the code for tha page I do my searching is: search.htm
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9">
<title>Untitled Document</title>
</head>
<body>
<form method="post" action="search_result.php">
<input type="text" name="search" size=25 maxlength=25>
<input type="Submit" name="Submit" value="Submit">
</form>
</body>
</html>
and this is my search result page:
<html>
<body>
<table width="100%" border="1" cellspacing="0" cellpadding="2">
<tr>
<th bgcolor="#CCCCCC" width=5%>
<?
//MySQL Connect.
mysql_connect("localhost","username","password");
//Database name.
mysql_select_db("db_name");
$search=$_POST["search"];
//The names of the db that I made ready
$result = $result = mysql_query("SELECT * FROM dictionary WHERE tr LIKE '%$search%' OR it LIKE '%$search%'");
while($r=mysql_fetch_array($result))
{
$tr=$r["tr"];
$it=$r["it"];
$id=$r["id"];
//I see the result here.
echo "$tr -> $it ";
echo "$it -> $tr ";
echo "<a href=".$url.">".$url."</a> <br>";
}
?>
</th>
</tr>
</table>
</body>
</html>
And now here my questions:
* How can I do this search on one page and keeping the search box still exist for another search. (I mean after I make a search I want to see the results under the search box)
AND
* How can I make a design for that page? Now I created an area (you can see the html codes above) in which I can see the results but the results always seem like this "Turkish word -> Italian corresponding , Italian word -> Turkish corresponding.
How can I solve this problem.
Thanks a lot
bailey
I have been in design world more than 5 years but I'm newbee in coding. And This time I want to prepare a dictionary for Italian - Turkish and Turkish - Italian. I prepared a simple database in phpmyadmin as an example to see the result (it has almost 10 words) and found some php codes to get the informations from the database.
This is the code for tha page I do my searching is: search.htm
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9">
<title>Untitled Document</title>
</head>
<body>
<form method="post" action="search_result.php">
<input type="text" name="search" size=25 maxlength=25>
<input type="Submit" name="Submit" value="Submit">
</form>
</body>
</html>
and this is my search result page:
<html>
<body>
<table width="100%" border="1" cellspacing="0" cellpadding="2">
<tr>
<th bgcolor="#CCCCCC" width=5%>
<?
//MySQL Connect.
mysql_connect("localhost","username","password");
//Database name.
mysql_select_db("db_name");
$search=$_POST["search"];
//The names of the db that I made ready
$result = $result = mysql_query("SELECT * FROM dictionary WHERE tr LIKE '%$search%' OR it LIKE '%$search%'");
while($r=mysql_fetch_array($result))
{
$tr=$r["tr"];
$it=$r["it"];
$id=$r["id"];
//I see the result here.
echo "$tr -> $it ";
echo "$it -> $tr ";
echo "<a href=".$url.">".$url."</a> <br>";
}
?>
</th>
</tr>
</table>
</body>
</html>
And now here my questions:
* How can I do this search on one page and keeping the search box still exist for another search. (I mean after I make a search I want to see the results under the search box)
AND
* How can I make a design for that page? Now I created an area (you can see the html codes above) in which I can see the results but the results always seem like this "Turkish word -> Italian corresponding , Italian word -> Turkish corresponding.
How can I solve this problem.
Thanks a lot
bailey