/    Sign up×
Community /Pin to ProfileBookmark

to delete item….

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

[code=php]<?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();
}
?>[/code]

and in body i wrote

[code=html]<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>[/code]

but the problem is that is not sending single to php to delete it. what did i missed!

AM

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @Alidad spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...