I am trying with PHP and MySQL Get data from database using search methods. It will show result in another page. How to get this result in same page.
This HTML
Script
<html>
<head>
<title>Digital Library</title>
</head>
<body>
<br />
<center>
<img src="logo.png"></img>
<h1>Digital Library</h1>
<h3>Enter Comapany Name</h3>
<form action="search.php" method="post">
<input type="text" name="term" /><br />
<input type="submit" name="submit" value="Submit" align="center" />
</form>
</center>
</body>
</html>
This is PHP
Script
<?php
mysql_connect ("localhost", "root","") or die (mysql_error());
mysql_select_db ("vdl");
$term = $_POST['term'];
$sql = mysql_query("select * from digital_library where company_name like '%$term%'");
while ($row = mysql_fetch_array($sql)){
Print "<strong>Comapny Name:</strong> ".$row['company_name']."<br>";
Print "<strong> Since: </strong> ".$row['since']."<br>";
Print "<strong> Strength: </strong> ".$row['strength']."<br>";
Print "<strong> Head Quarters: </strong> ".$row['head_quarter']."<br>";
Print "<strong> Location (City): </strong> ".$row['locations']."<br>";
Print "<strong> Development Centers: </strong> ".$row['development_centers']."<br>";
Print "<strong> Customers: </strong> ".$row['customers']."<br>";
Print "<strong> MNC: </strong> ".$row['mnc']."<br>";
Print "<strong> CMMI: </strong> ".$row['cmmi']."<br>";
Print "<strong> Domains: </strong> ".$row['domains']."<br>";
Print "<strong> Industries: </strong> ".$row['industries']."<br>";
Print "<strong> Domain Competitors: </strong> ".$row['domain_competitor']."<br>";
Print "<strong> Products: </strong> ".$row['products']."<br>";
Print "<strong> Services: </strong> ".$row['services']."<br>";
Print "<strong> Uniqueness: </strong> ".$row['uniqueness']."<br>";
Print "<strong> URL: </strong> ".$row['url']."<br>";
Print "<strong> Onsights: </strong> ".$row['onsight']."<br>";
Print "<strong> Benefits: </strong> ".$row['benefits']."<br>";
Print "<strong> Awards: </strong> ".$row['awards']."<br>";
echo '<br/><br/>';
}
?>
I am tried with put code into after <body>
tag but it won't work.