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); } 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 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.... 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 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
Archived
This topic is now archived and is closed to further replies.