rabesh Posted June 1, 2011 Share Posted June 1, 2011 if($_GET['task']=='del') { $id=$_GET['id']; $name=$_GET['new_image']; mysql_query('delete from tbl_gallery where id="'.$id.'"' ); unlink ($name); } Quote Link to comment https://forums.phpfreaks.com/topic/238069-notice-undefined-index-task-in/ Share on other sites More sharing options...
DarkKnight2011 Posted June 1, 2011 Share Posted June 1, 2011 Hi, It seems that task is not being passed into the script, check your url contains something like index.php?task=value. it may be better to check task is set before you continue by doing // Check that task has been passed to the script if (isset($_GET['task'])) { if($_GET['task']=='del') { $id=$_GET['id']; $name=$_GET['new_image']; mysql_query('delete from tbl_gallery where id="'.$id.'"' ); unlink ($name); } } Hope this helps, DK Quote Link to comment https://forums.phpfreaks.com/topic/238069-notice-undefined-index-task-in/#findComment-1223378 Share on other sites More sharing options...
rabesh Posted June 1, 2011 Author Share Posted June 1, 2011 Thank a lot DarkKnight2011 It works.... Quote Link to comment https://forums.phpfreaks.com/topic/238069-notice-undefined-index-task-in/#findComment-1223407 Share on other sites More sharing options...
DarkKnight2011 Posted June 1, 2011 Share Posted June 1, 2011 Glad to of helped Quote Link to comment https://forums.phpfreaks.com/topic/238069-notice-undefined-index-task-in/#findComment-1223436 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.