This is the HTML code for my search form which ia m using to take input.
<div class="srcarea">
<form action="result_page.php" method="post">
<input type="text" name="search" class="search" placeholder="What's On Your Mind Today?"></br>
<input type="submit" name="" value="Go" class="srcbtn">
</form>
</div>
This is the PHP code whis searches the database for the result .
<?php
include 'connection.php';
$result ='';
$count='';
// Create connection
//$conn = mysqli_connect($servername, $username, $password);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
//echo "Connected successfully";
mysqli_select_db($conn,"search") or die ("Could Not find the db");
$output = "";
if(isset($_POST['search'])) {
#$searchq = $_POST['search'];
$searchq = mysqli_real_escape_string($conn,$_POST['search']);
if($searchq !="")
{
$result=$query = mysqli_query($conn,"SELECT * FROM members WHERE firstname LIKE '%$searchq%' OR lastname LIKE '%$searchq%'");
}
if($result){
$count =mysqli_num_rows($query);
}
if($count ==0)
{
$output = 'No Results Found !';
}
else
{
while($row = mysqli_fetch_array($query)){
$fname = $row['firstname'];
$lname = $row['lastname'];
$id = $row['id'];
$output .='<div>'.$fname.' '.$lname.'</div>';
}
}
}
//echo ($output);
?>
And I am displaying output of the search over this page where i get confirm resubmission dialogue i have looked for the possible solutions over here but i'm unable to fix the same.
<div class="header">
<?php
include 'header.php';
?>
</div>
<div id="res">
<?php
include 'search.php';
?>
<?php print("output")?>
</div>
I need to fix this.