File search.php in CookBook
<?php require_once('Include/config.php'); ?> <html> <head> <title>The Tullos-Sexton Cookbook</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="cookbook.css" rel="stylesheet" type="text/css"> </head> <body> <div id="main"> <?php include('Include/nav.php'); ?> <hr size="1"> <?php // process form if (isset($_GET['query'])) { $query = $_GET['query']; $sql = "SELECT * FROM cookbook_recipes WHERE title like '%$query%' OR directions like '%$query%' OR ingredients like '%$query%'"; //echo $sql; $result = mysql_query($sql); print ( "<i>Search Results for '$query'</i><br>"); while ($myrow = mysql_fetch_row($result)) { ?><a href='view.php?id=<?=$myrow[0]?>'><?=$myrow[1]?></a> <!--span class="TextTitle">[<a href='edit.php?id=<?=$myrow[0]?>'>edit</a>][<a href='delete.php?id=<?=$myrow[0]?>'>delete</a>]</span--><br /><?php } } //printf("Title: %s<br>\n", mysql_result($result,0,"title")); //while ($myrow = mysql_fetch_row($result)) {printf("%s [<a href='edit.php?id=%s'>edit</a>]<br>\n", $myrow[1], $myrow[0]);} ?> <form action="search.php" method="get" name="Search" target="_self"> <input name="query" type="text" value="<?=$query?>"> <input name="submit" value="search" type="Submit"> </form> </div> <div class="copyright" align="center">© 2004 <a href="http://www.fuzzymonk.com">Chrisopher Sexton</a></div> </body> </html>
