 <p>According to your logic, it is impossible for both conditions to run at the same time. However, I'm sure you've run this script multiple times. Sometimes with IF, sometimes with ELSE. It doesn't seem like you're ever clearing the $_SESSION variables.</p> <p>Solution: Right after you use the $_SESSION['save'] or $_SESSION['error'] variables, unset them.</p> <pre><code>unset($_SESSION['save']); </code></pre> <p>or</p> <pre><code>unset($_SESSION['error]'); </code></pre>