I have a page where there is search field. the page is designed to have the result on the same page with an id when the submit link is clicked the results will appear below. The submit button is a link not the traditional submit buttons. My problem is i have done all the php stuff but when i click on the link that would let the result appear, the php doesn't run. Could someone please help me out. below is the code. Thanks
<form action="" method="post">
<div class="col-md-9">
<div class="row">
<div class="col-md-7 no-padding">
<div class="inner">
<h3>Track & Trace</h3>
<span>Already have a load ID, please insert it below</span>
</div>
</div>
<div class="col-md-5 no-padding">
<input class="input-fullwidth" name="track" id="track">
</div>
</div>
</div>
<div class="col-md-3">
<a id="track-it" href="#section-tracking-result" class="btn-custom btn-fullwidth">Track it</a>
</div>
</form>
<?php
define('DB_HOST','localhost');
define('DB_USER','username');
define('DB_PASS','password');
define('DB_NAME','dbname');
$conn = mysql_connect(DB_HOST,DB_USER,DB_PASS) or die(mysql_error());
mysql_select_db(dbname) or die(mysql_error());
$output = '';
if(isset($_POST['track'])) {
if(empty($_POST['track'])) {
echo "Tracking Code is Required";
}
$searchq = $_POST['track'];
$searchq = preg_replace("#[^0-9a-z]#i", "",$searchq);
$query = mysql_query("SELECT * FROM track WHERE keywords LIKE '%$searchq%'");
$count = mysql_num_rows($query);
if($count == 0) {
$output = 'There was no search results!';
} else {
while($row = mysql_fetch_array($query)) {
$consignee = $row['consignee'];
$desti = $row['desti'];
$date = $row['date'];
$id = $row['id'];
}
}
}
?>