I want to make search page(php) where I want to display my searched data from database in a "div"?I made a connection with database and searched for data in one phppage and created a div tag in another phppage.how can i display the searched data of one php page to be displayed in another php page's "div"
Search.php:
<?php
include 'Searchdata.php';
include 'connect.php';
if(isset($_POST['submit'])){
$searchkey= $_POST['search'];
$searchkey=preg_replace("#[^0-9a-z]#i", "", $searchkey);
$query = mysqli_query($conn, "SELECT * FROM newentry WHERE Date LIKE '%$searchkey%'")or die("Could not search!");
$count = mysqli_num_rows($query);
if(!($count == 0)) {
while($row=mysqli_fetch_array($query)){
$Date=$row['Date'];
$Entry=$row['Entry'];
echo'<div>'.$Date.'<br>'.$Entry.'</div>';
}
} else {echo "There was no search result!";}
}?>
Searchdata.php:
<div>
<form action="Search.php" method="post">
<input type="text" name="search" placeholder="Search">
<input type="submit" value="Search" />
</form>