I have a basic backoffice setup with a few tables listing the database content with an option to delete the rows, based on the id. But for every product that I have, I need to have different PHP delete files, in this example, "product_01"
, "product_02"
, etc.
How can I pass a custom id in the query string (href='delete_product_01.php?id=...
) so I can have a conditional statement in the delete php file, this way I would only need one delete.php file.
Thank you
back.php.php
echo "<td class='deleteMe'><a class='delete_back' href='delete_product_01.php?id=".$record['id']."'>x</a></td>";
delete_product_01.php
include('config_delete.php');
if (isset($_GET['id'])) {
$id = $_GET['id'];
$query = mysql_query("DELETE FROM product_01_table WHERE id='$id'");
if ($query) {
header('location:back.php');
}
}