I have this input box and button in my navigation page
form class="navbar-form"
div class="form-group"
form action="search.php" method="POST">
input type="text" class="form-control" name="search"
placeholder="Search for Products..."
input type="submit" value="Submit"
/form
/div
/form
which is located at the top of my index.php page and in my search.php $output = '';
<!--collect -->
if(isset($_POST['search'])) {
$searchQ = $_POST['search'];
$searchQ = preg_replace("#[^0-9a-z]#i","",$searchQ);
$query = mysql_query("SELECT * FROM products WHERE title LIKE
'%$searchQ%' OR part_number LIKE '%$searchQ%' OR stock_code LIKE
'%$searchQ%' OR form_factor LIKE '%$searchQ%' ") or die("could not
search!");
$count = mysqli_num_rows($query);
if($count == 0) {
$output = '"There was no search results"';
} else {
while($row = mysql_fetch_array($query)) {
$title = $row['title'];
$partNumber = $row['part_number'];
$stockCode = $row['stock_code'];
$formFactor = $row['form_factor'];
$id = $row['id'];
$output .= '<div>'.$title.' </div>';
}
}
}
when i click the button the url goes from http://localhost/alphacomponents.co.uk/index.php to http://localhost/alphacomponents.co.uk/index.php?search=Asus
and i have dev tool'd it and no errors appear. Any ideas?