delete options
Posted: Thu Dec 19, 2013 1:54 pm
hi, i'm having trouble to understand how this php works, i wrote php to give me an options whether to delete or not, please see in php code
And in body i wrote button code
<[text]td width="12%" align="center"><input type="submit" name="Delete" id="Delete" value="Delete" />
<?php '<a href="item.php?yesdelete=' . $_GET['deleteid'] . '"></a>'?>
</td>
<td width="35%"><input type="submit" name="Cancel" id="Cancel" value="Cancel" />
<?php '<a href="item.php?nodelete=' . $_GET['deleteid'] . '"> </a>'?></td>
</tr>
[/text]
But the problem is that is not sending single to php to delete it. what did i missed!
AM
Code: Select all
<?php
if (isset($_GET['yesdelete'])) {
$id_to_delete = $_GET['yesdelete'];
if ($id_to_delete = $sql->query("DELETE FROM product WHERE product_id='$id_to_delete' LIMIT 1"))
$pictodelete = ("product_images/$id_to_delete.jpg");
if (file_exists($pictodelete)) {
unlink($pictodelete);
}
header("location: product-copy-4.php");
exit();
}
if (isset($_GET['nodelete'])) {
$id_to_delete = $_GET['nodelete'];
header("item.php?pid=' . $product_id . '");
exit();
}
?><[text]td width="12%" align="center"><input type="submit" name="Delete" id="Delete" value="Delete" />
<?php '<a href="item.php?yesdelete=' . $_GET['deleteid'] . '"></a>'?>
</td>
<td width="35%"><input type="submit" name="Cancel" id="Cancel" value="Cancel" />
<?php '<a href="item.php?nodelete=' . $_GET['deleteid'] . '"> </a>'?></td>
</tr>
[/text]
But the problem is that is not sending single to php to delete it. what did i missed!
AM