Sorry! when I selected category "Title" and search a title for example "around the world 80 days" and then click submit.
The problem is, how can I search "around the world 80 days" that links to the category "Title"? or If I search a medium "DVD" from the category Medium. Hope you understand what i mean. Thanks
search.html
<html><body>
<form method="post" action="search_action.php">
<select>
<option selected>Choose your search</option>
<option>Title</option>
<option>Topic</option>
<option>Medium</option>
</select>
<input type="text" name="search" ><br>
<input type="submit" name="submit" value="Search">
</form>
</body></html>
This piece of code is not working as I explanied. What can I do here????
search_action.php
<?php
include("dbconnect.php");
$search=$_POST["search"];
if(!$search)
{
echo("Empty search. <a href='search.html'>Try again</a>");
}
else
{
$result=mysql_query("SELECT *FROM media WHERE Tittel LIKE '%$search%'");
if(mysql_num_rows($result) <= 0)
{
echo (mysql_num_rows($result))." Match. <a href='search.html'>Prøv igjen</a><br> ";
}
else
{
echo (mysql_num_rows($result))." Matches.<br>";
}
while($r=mysql_fetch_array($result))
{
$Tittel=$r["Tittel"];
echo "<a href='sok_tittel_list.php?tittel=$Tittel'>[ $Tittel ] </a><br>";
}
}
?>