Jump to content

Notice: Undefined variable: GET


co.ador

Recommended Posts

I don't know why I am getting an undefined variable when the url is define. look at the deleteid=6 it means it is defined and in the code it is written as below

 

URL


<?php 
if(isset($_GET['deleteid'])){ //which is clearly active in the url then get it, 

/* line 27 ===> */   echo'Do you really want to delete pdoruct with ID of '. $GET ['deleteid'] . '? <a href="inventory_list.php?yesdelete=' . $GET ['deleteid'] .   '">Yes</a> |<a href="inventory_list.php"> No</a>';
exit();
}
if (isset($_GET['yesdelete'])) {
// remove item from system and delete its picture
// delete from database
$id_to_delete = $_GET['yesdelete'];
$sql = mysql_query("DELETE FROM products WHERE id='$id_to_delete' LIMIT 1") or die (mysql_error());
// unlink the image from server
// Remove The Pic -------------------------------------------
    $pictodelete = ("../inventory_images/$id_to_delete.jpg");
    if (file_exists($pictodelete)) {
       		    unlink($pictodelete);
   
}
header("location:inventory_list.php"); 
    exit();
}

?>

 

the echo

<?php echo 'Do you really want to delete pdoruct with ID of '. $GET ['deleteid'] . '? <a href="inventory_list.php?yesdelete=' . $GET ['deleteid'] .  '">Yes</a> |<a href="inventory_list.php"> No</a>'; ?>

won't display the . $GET ['deleteid'] .  after "Do you really want to delete product with ID of which is 6 but it won't display the number six with the actual configuration, instead it display it like

 

Notice: Undefined variable: GET in /home3/nyhungry/public_html/storeprueba/storeadmin/inventory_list.php on line 27

 

Notice: Undefined variable: GET in /home3/nyhungry/public_html/storeprueba/storeadmin/inventory_list.php on line 27

Do you really want to delete pdoruct with ID of ? Yes | No

 

Notice not number in between 'ID of'  and '?'

Link to comment
https://forums.phpfreaks.com/topic/231661-notice-undefined-variable-get/
Share on other sites

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.