co.ador Posted March 25, 2011 Share Posted March 25, 2011 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 http://www.ppp.com/storeprueba/storeadmin/inventory_list.php?deleteid=6 <?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 '?' Quote Link to comment https://forums.phpfreaks.com/topic/231661-notice-undefined-variable-get/ Share on other sites More sharing options...
trq Posted March 25, 2011 Share Posted March 25, 2011 Its $_GET not $GET. Quote Link to comment https://forums.phpfreaks.com/topic/231661-notice-undefined-variable-get/#findComment-1192034 Share on other sites More sharing options...
co.ador Posted March 25, 2011 Author Share Posted March 25, 2011 Its $_GET not $GET. So simple my God.. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/231661-notice-undefined-variable-get/#findComment-1192035 Share on other sites More sharing options...
trq Posted March 25, 2011 Share Posted March 25, 2011 It helps if you debug your code yourself before simply pumping out questions on a forum. It'll not only make you a better programer but a faster one. Quote Link to comment https://forums.phpfreaks.com/topic/231661-notice-undefined-variable-get/#findComment-1192037 Share on other sites More sharing options...
co.ador Posted March 25, 2011 Author Share Posted March 25, 2011 Thank you, for your advice I am realizing day by day it just simple stuff that will throw the code off sometimes. I am taking in mind debugging character by character. Quote Link to comment https://forums.phpfreaks.com/topic/231661-notice-undefined-variable-get/#findComment-1192112 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.