I'm having a problem with a search I'm coding. Here are the contents of the files:
srch.php
search.php
Everytime I try to do a search, it tells me that no search string was entered. Can anyone please help me figure out what I'm doing wrong?
Thanks!
srch.php
Code:
<?php
include("config.php");
if ($search) // perform search only if a string was entered.
{
mysql_connect() or die ("Problem connecting to Database");
$srch="%".$search."%";
$query = "select * from phpbb_forums WHERE forum_name like '$srch'";
$result = mysql_db_query("isaac_fortgamer", $query);
if ($result)
{
echo "Here are the results:<br><br>";
echo "<table width=90% align=center border=1><tr>
<td align=center bgcolor=#00FFFF>Forum Name</td>
</tr>";
while ($r = mysql_fetch_array($result)) { // Begin while
$fname = $r["forum_name"];
echo "<tr>
<td>$fname</td>
</tr>";
} // end while
echo "</table>";
} else { echo "problems...."; }
} else {
echo "Search string is empty. <br> Go back and type a string to search";
}
include ('links.x');
?>
search.php
Code:
<html>
<head><title>Searching the Forums</title>
</head>
<body bgcolor=#ffffff>
<h1>Searching the Database</h1>
<form method="post" action="srch.php">
<table width=90% align=center>
<tr><td>search for:</td><td><input type=text name='search' size=60 maxlength=255></td></tr>
<td></td><td><input type=submit></td></tr>
</table>
</form>
<?php include ('links.x');?>
</body>
</html>
Everytime I try to do a search, it tells me that no search string was entered. Can anyone please help me figure out what I'm doing wrong?
Thanks!







