I'm creating this table:
foreach($result as $row) {
echo("
<tr>
<td>$row[KLANTNR]</td>
<td>$row[VOORNAAM]</td>
<td>$row[ACHTERNAAM]</td>
<td>$row[ADRES]</td>
<td>$row[POSTCODE]</td>
<td>$row[WOONPLAATS]</td>
<td>$row[PROVINCIE]</td>
<td>$row[TELEFOON]</td>
</tr>");
}
there needs to be a button/link that deletes the row the button/link is on, the same for an edit button/link ( https://gyazo.com/53fb627380bcc901cf8df2f2a7d132b2 ) though I have no idea how to achieve this.
does anyone have an idea?
You can add edit and delete button/link in your php code like that:
foreach($result as $row) {
echo("
<tr>
<td>$row[KLANTNR]</td>
<td>$row[VOORNAAM]</td>
<td>$row[ACHTERNAAM]</td>
<td>$row[ADRES]</td>
<td>$row[POSTCODE]</td>
<td>$row[WOONPLAATS]</td>
<td>$row[PROVINCIE]</td>
<td>$row[TELEFOON]</td>
<td><a href="edit.php?id=$row[id]">Edit</a></td>
<td><a href="delete.php?id=$row[id]">Delete</a></td>
</tr>");
}
You need to write php code to delete and edit. You can get the id in your php code like that:
$id = $_GET['id']
and base on that id, you can delete and edit.
Thanks!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.