I would like to know how I can use the GET-method in my .php file: forumdocument.php to get the ID of the href that is clicked in table.php
I hope this is the right way to begin it:
'<a class="formtitellink" href="forumdocument.php" id="$row['ID']">' . $row['Titel'] . '</a>' . "</td>";
table.php:
$query = "Select *
from forum";
$resultaat = mysql_query($query, $connectie);
echo "<table border='1'>
<tr>
<th>ID</th>
<th>Tijd</th>
<th>Gebruikersnaam</th>
<th>Titel</th>
</tr>";
while($row = mysql_fetch_array($resultaat))
{
$_SESSION['row'] = $row;
echo "<tr>";
echo "<td>" . $row['Tijd'] . "</td>";
echo "<td>" . $row['Gebruikersnaam'] . "</td>";
echo "<td>" . '<a class="formtitellink" href="forumdocument.php" id="$row['ID']">' . $row['Titel'] . '</a>' . "</td>";
echo "</tr>";
}
echo "</table>";
A GET method is used for name value pairs in a url.
Example:
www.test.com?var1=var1&var2=var2
Here if we use
$_GET['var1']
the expected value would bevar1
.Just change your links to reflect the desired variable
Then you can use retrieve the
id
using something like this onforumdocument.php