Jump to content

Recommended Posts

I'm trying to pass a product_id through a URL, to delete the product from the database:

 

<a href="./admincp.php?do=delete&id='.$product_id.'">Delete Product</a>

 

My issue is the code below is not getting the product_id from the URL.

 

elseif($_GET['do']=="delete"){
if(isset($_GET['id'])){
$product_id=$_GET['id'];
$sql5000="DELETE FROM $tbl_name WHERE product_id=".$product_id."";
mysql_query($sql5000);
$sql5500="DELETE FROM $tbl_name2 WHERE product_id=".$product_id."";
mysql_query($sql5500);
header("Location: ./admincp.php?deleted=yes");
}
}

Link to comment
https://forums.phpfreaks.com/topic/236528-issue-passing-product_id-through-url/
Share on other sites

Never mind...

 

<a href="./admincp.php?do=delete&id='.$product_id.'">Delete Product</a>

 

should have been:

 

<a href="./product_process.php?do=delete&id='.$product_id.'">Delete Product</a>

 

Basically I was trying to process the product_id with the wrong file.

 

Too early to be coding...

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.