#
<form name="Item Search" method="post" action="search1.php">
#
Item Search:<br>
#
<label>
#
<input name="swords" type="text" size="30" maxlength="30">
</label>
<br>
<label>
<input name="search" type="submit" id="search" value="Search">
</label>
<a href="logout.php">Logout</a>
</form>
<?php
if(isset($_POST['submit'])||isset($_POST['swords'])||isset($_GET['swords'])){
if (isset($_POST['swords']))
{
$search=$_POST['swords'];
}else
{
$search=$_GET['swords'];
}
$newurl = "search.php?swords=";
$searchwords = addslashes(htmlspecialchars($_POST['swords']));
{
$words = explode(' ',$searchwords);
$totalwords = count($words);
$i = 0;
$searchstring = "";
while ($i != $totalwords){
if ($i != 0 and $i != $wordcount){
$searchstring .= " and ";;
}
$searchstring .= "b_name LIKE '%$words[$i]%'";
$searchstring1 .= "b_author LIKE '%$words[$i]%'";
$i = $i + 1;
when i search "the" it's show all the "the" first words but if i type "the giver"
it dont show anything how can i search in the database if i have space above is my code i use can anybody modify it?