Trollolol Posted June 26, 2012 Share Posted June 26, 2012 I have had a problem since last night and I can't find where I have made the mistake and hoping someone can help me. if (empty($_SESSION['rounds'])) { $_SESSION['rounds'] = '0'; } elseif ($_POST['go']) { $_SESSION['rounds']++; } $_SESSION['rounds'] sets to 0 fine, but thereafter won't increase with each $_POST['go']. Can anyone see a problem I have made or is the problem likely being caused some where else? Quote Link to comment https://forums.phpfreaks.com/topic/264798-cant-see-my-own-problem-and-its-been-24-hours/ Share on other sites More sharing options...
kicken Posted June 26, 2012 Share Posted June 26, 2012 '0' is considered to be empty by the empty function, so you are always hitting that branch. Use isset() to check if it exists instead. Quote Link to comment https://forums.phpfreaks.com/topic/264798-cant-see-my-own-problem-and-its-been-24-hours/#findComment-1357048 Share on other sites More sharing options...
Trollolol Posted June 26, 2012 Author Share Posted June 26, 2012 Nah its all good man. I just changed elseif to if. Thanks anyway! Solved. Quote Link to comment https://forums.phpfreaks.com/topic/264798-cant-see-my-own-problem-and-its-been-24-hours/#findComment-1357049 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.