Jump to content

issue passing product_id through url


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...

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.