Hyaku_ Posted January 9, 2007 Share Posted January 9, 2007 Hi!I know that I can just remove error reporting form php.ini, but how can I prevent this warning in code? because even if I check if the variable is set, I still get the error! Thanks! Link to comment https://forums.phpfreaks.com/topic/33432-solved-undefined-index-will-it-ever-go-away/ Share on other sites More sharing options...
btherl Posted January 9, 2007 Share Posted January 9, 2007 Post the code generating the warning. Link to comment https://forums.phpfreaks.com/topic/33432-solved-undefined-index-will-it-ever-go-away/#findComment-156511 Share on other sites More sharing options...
Hyaku_ Posted January 9, 2007 Author Share Posted January 9, 2007 stupid example, but anyway:[code]if($_REQUEST['query']){ echo $_REQUEST['query'];}[/code] Link to comment https://forums.phpfreaks.com/topic/33432-solved-undefined-index-will-it-ever-go-away/#findComment-156512 Share on other sites More sharing options...
magic2goodil Posted January 9, 2007 Share Posted January 9, 2007 if there is a value in $_RESQUEST['query'] besides a boolean value then it's going to have an error unless called upon with if(isset()) Link to comment https://forums.phpfreaks.com/topic/33432-solved-undefined-index-will-it-ever-go-away/#findComment-156515 Share on other sites More sharing options...
Hyaku_ Posted January 9, 2007 Author Share Posted January 9, 2007 Thanks again!isset(); solved the problem!! ;D Link to comment https://forums.phpfreaks.com/topic/33432-solved-undefined-index-will-it-ever-go-away/#findComment-156517 Share on other sites More sharing options...
magic2goodil Posted January 9, 2007 Share Posted January 9, 2007 [quote author=Hyaku_ link=topic=121611.msg500486#msg500486 date=1168328765]Thanks again!isset(); solved the problem!! ;D[/quote]No problem man. Hey make sure to set this as solved at the bottom left please.:) Link to comment https://forums.phpfreaks.com/topic/33432-solved-undefined-index-will-it-ever-go-away/#findComment-156521 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.