I have a website where the user enters the name of a movie, a search is done on an SQL db and all movies with a similar name are displayed in a table format.
The name of each movie is also a link to a second page which displays further details about this movie.
However in order to get the further details, I need to do another query on this movie on the second page, so ideally when the user clicks on the movie name on the first page, the link should also post the name of the movie to the second page as a variable.
I can then take that variable and use it in the query on the second page.
I dont want to add invisible forms as this still adds buttons to the table, I need the table to stay as it is.
<?php
$username = "root";
$password = "";
$hostname = "localhost";
$db_handle = mysql_connect($hostname, $username, $password) or die ("Could not connect to database");
$selected= mysql_select_db("login", $db_handle);
$output='';
$output1='';
$tablehead='';
if(isset($_POST['search'])){
$searchq = $_POST['search'];
$query = mysql_query("SELECT * FROM PHP_Item WHERE Name LIKE '%$searchq%'") or die ("Could not search");
$count = mysql_num_rows($query);
if($count == 0){
$output = 'there were no search results';
}else{
$tablehead.= "<table id='searchtable'>
<tr>
<th>
Name
</th>
<th>
Price
</th>
</tr>
</table>";
while($row = mysql_fetch_array($query)){
$mName = $row['Name'];
$price = $row['Price'];
$id= $row['ItemID'];
$output1.=
"<table id='searchtable'>
<tr>
<td>
<a href='searchresult.php'>$mName</a>
</td>
<td>
£$price
</td>
</tr>
</table>";
}
}
}
?>