arunpatal Posted November 15, 2012 Share Posted November 15, 2012 This is my if else statement.... But it dose not show $codes1 Is something wrong with it??? <?php if(isset($codes3)) { echo"<br/><div id='codedisplay_box' style='overflow: auto;'><code><xmp> $codes3</xmp></code></div><br/>"; } else { echo"<div id='codedisplay_box' style='overflow: auto;'><code><xmp>$codes1</xmp></code></div>"; } ?> Link to comment https://forums.phpfreaks.com/topic/270761-if-and-else/ Share on other sites More sharing options...
requinix Posted November 16, 2012 Share Posted November 16, 2012 Apparently so, since it doesn't do what you want it to do. If the $codes1 string isn't being shown then isset($codes3). If the string is being shown and that value is empty then, well, that value is empty. Link to comment https://forums.phpfreaks.com/topic/270761-if-and-else/#findComment-1392808 Share on other sites More sharing options...
cyberRobot Posted November 16, 2012 Share Posted November 16, 2012 Did you try using something like var_dump() to see what $codes1 and $codes3 actually contain? http://php.net/manual/en/function.var-dump.php Link to comment https://forums.phpfreaks.com/topic/270761-if-and-else/#findComment-1392945 Share on other sites More sharing options...
Jessica Posted November 16, 2012 Share Posted November 16, 2012 You need to start using descriptive variable names. Link to comment https://forums.phpfreaks.com/topic/270761-if-and-else/#findComment-1392946 Share on other sites More sharing options...
MDCode Posted November 16, 2012 Share Posted November 16, 2012 Just because $codes3 isn't set, doesn't mean that $codes1 is set. There's no way to tell by that snippet you've shown. Link to comment https://forums.phpfreaks.com/topic/270761-if-and-else/#findComment-1392948 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.