Code: Select all
<html>
<head><title>Definitions</title></head>
<body>
<?php
$user="--------";
$host="-------";
$password="------";
$database = "dictionary";
$cxn = mysqli_connect($host,$user,$password,$database)
or die ("couldn't connect to server");
$wordname = 'name'
$query = "SELECT * FROM word WHERE wordname='$wordname'";
$result = mysqli_query($cxn,$query)
or die ("Couldn't execute query.");
/* Display results in a table */
echo "<h1>$wordname</h1>";
echo "<table cellspacing='15'>";
echo "<tr><td colspan='3'><hr /></td></tr>";
while($row = mysqli_fetch_assoc($result))
{
extract($row);
echo "<tr>\n
<td>$worddef</td>\n
<td>$wordsent</td>\n
</tr>\n";
echo "<tr><td colspan='3'><hr /></td></tr>\n";
}
echo "</table>\n";
?>
</body></html>
The html form searchbox's code is:
Code: Select all
<head>
<title>Search</title>
</head><body>
<h3>Search Below</h3>
<form name="wordname" action="wordDisplay.php"
method="post">
Search:
<input type="text" name="name">
<input type="submit" value="Search">
</form>
</body>
</html>