This is a repost but my previous one wouldn't let me edit. I'm trying to take details from a html/php page and allow at the user to "search" through the results page, however, when I enter a search term nothing is displayed on the search.php page.
HTML/PHP showing current details + searchbox:
<form method="post" action="search.php">
<input type="text" name="search" />
<input type="submit" name="submit" value=" Search ">
</form>
<div id="leftdiv" style="width: 40%; float:left">
<form id="form1" method="get">
<table id="table">
<th>Property ID</th>
<th>Property Name</th>
<?php
$result = mysql_query("SELECT * FROM Property");
while ($row = mysql_fetch_array($result))
{
$pID = $row['pID'];
$pLocation = $row['pLocation'];
echo "<tr data-row='$pID'><td>$pID</td>";
echo "<td>".$pID."</td>";
echo "<td>".$pLocation."</td>";
}
?>
</table>
</form>
</div>
searchresults.php code:
$search=$_POST['search'];
$sql="SELECT * FROM Property
WHERE pLocation like 'search%'";
$result=mysql_query($sql) or die(mysql_error());
while ($row=mysql_fetch_array($result))
{
$pID = $row['pID'];
$pLocation = $row['pLocation'];
echo "<tr data-row='$pID'>";
echo "<td>".$pID."</td>";
echo "<td>".$pLocation."</td></tr>";
}
Essentially all im trying to do is display all properties in database, then allow user to filter results based on location. If they type in London, only properties in London to be shown.