<?php
include 'db.php';
include 'config.php';
function searchform(){
echo '
<form method="post" action="">
<input type="text" name="searchstring"> <input type="submit" name="searchsubmit" value="Search" />
</form>
';
}
if($_POST['searchsubmit']){
$string = slash2($_POST['searchstring']);
$sql = "SELECT * FROM $newstable WHERE title LIKE '%$string%' OR shortstory LIKE '%$string%' OR story LIKE '%$string%'";
$query = mysql_query($sql);
$amount = mysql_num_rows($query);
echo "Results found: <b>$amount</b>";
echo "<hr />";
while($row = mysql_fetch_array($query)){
echo "<a href=\"index.php?id=$row[id]\"/>$row[title]</a><br />";
}
}else{
searchform();
}
?>
<?php
include 'news/index.php';
?>
<?php
include 'news/index.php';
?>