php


I have these two pages of code and wants to show result on other pages


This is index.php
<html>
<head>
<meta name="viewport" content="width='device-width', initial-scale=1.0">
<title>Search My DB</title>
</head>
<body>
<div id="container">
<div id="search-form">
<form action="process.php" method="POST">
<input type="search" name="search" id="search-input" placeholder="Type
Something To Search">
<br/>
<input type="submit" name="search-submit" id="search-submit" value="Search">
</form>
</div>
</div>
<a href="something.php"><?php include 'process.php';
echo
$_SESSION['heading']."<br>"; ?></a>
</body>
</html>
On this page I am showing the link which will lead to other details of the search result. But the problem is that I have multiple headings of the same type in my table but here it is printing just one the last in the table related to the result.
Here is process.php
<?php
session_start();
$conn = new mysqli('localhost', 'root', '', 'posts');
if (isset($_POST['search-submit'])) {
$search = $_POST['search'];
$query = "SELECT * FROM posts where heading LIKE '%$search%' ";
$result = $conn->query($query);
while ($row =$conn->fetch_assoc($result) ) {
$post = $row['post'];
$head = $row['heading'];
$time = $row['time'];
$_SESSION['post'] = $post;
$_SESSION['heading'] = $head;
$_SESSION['time'] = $time;
}
header ('location: index.php');
}
?>
How can I show multiple results as google or other sites do?

Related Links

download image Data (blob) in JSON format using PHP
Retrieving JSONP in PHP not working
How middleware works in user multiple login in laravel 5.1?
How can one determine the pkey of an inserted row after using pg_insert()?
Save multiple records based on user input in Cakephp
Passing multiple data using AJAX
CakePhp print if controller & function is not
How to change empty string to a null using Laravel 5.1?
Laravel 5 add nusoap
looping through xpath results
Laravel 5 : Method Not Allowed Http Exception in Route Collection.php line 201:
Declare static and dynamic methods with same name in PHP
Display static data in html page
Unable to email using php when add context type
PHP mail will only send with two recipients
Managing uploaded files in Laravel - linking public and storage directories

Categories

HOME
amazon-web-services
yaml
swi-prolog
foaf
filesize
ant
initialization
magento-2.0
semantic-web
biztalk-2010
stored-procedures
hystrix
yeoman-generator-angular
watch-os-3
temperature
google-tasks-api
pinterest
fosuserbundle
google-sites
string-formatting
cloudsim
http-authentication
websphere-portal
quartz.net
pubxml
cellular-network
beego
fusion
toad
winsock
argv
caesar-cipher
directfb
restful-architecture
nsuserdefaults
python-sounddevice
swfupload
newtons-method
raytracing
elasticsearch-aggregation
reverse-dns
kitura
jenkins-slave
linq-to-excel
absolute
ilrepack
renderman
solr-query-syntax
sequence-diagram
gtk#
asp.net-web-api-routing
mongodb-aggregation
wikimapia
ltrace
yargs
cocoa-bindings
coovachilli
node-glob
teamviewer
univocity
django-validation
arbre
calcite
pythonxy
karma-coverage
textscan
wicked-gem
webproject
scala-macros
mgwt
rpg
neo4jphp
refit
nosql-aggregation
lync-2010
jmenubar
yii-booster
insertonsubmit
dynamic-rdlc-generation
blobstorage
arel
linkbutton
ip-geolocation
live-wallpaper
getproperty
jdom
platform-independent
autosize
background-repeat
server-variables
canonicalization
fragment-identifier
jmenu
libxslt
tabbarcontroller
zend-test
external-sorting
remote-working
code-camp
jvm-bytecode

Resources

Encrypt Message