unidox Posted June 27, 2008 Share Posted June 27, 2008 I have this if statement: if (($_GET['s'] == 'news') && (in_array("news", $array))) { is there anyway that if its not in the array, I can make a var like $error. ? Thanks Link to comment https://forums.phpfreaks.com/topic/112231-if-inside-an-if/ Share on other sites More sharing options...
Wolphie Posted June 27, 2008 Share Posted June 27, 2008 I don't really see your problem.. if(($_GET['s'] == 'news') && (in_array($_GET['s], $array)) { // successful } else { // failed } Link to comment https://forums.phpfreaks.com/topic/112231-if-inside-an-if/#findComment-576183 Share on other sites More sharing options...
unidox Posted June 27, 2008 Author Share Posted June 27, 2008 Well I am going to use elseif, like.... if (($_GET['s'] == 'news') && (in_array("news", $array))) { do something } elseif (($_GET['s'] == 'threads') && (in_array("news", $array))) { do something } else { echo "Sorry, this action was not able to be performed."; } I want to add an elseif ($error) { echo "You do not have access."; } Link to comment https://forums.phpfreaks.com/topic/112231-if-inside-an-if/#findComment-576186 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.