php isset not working in if statement
<p>Yesterday I posted a question about a problem I was having with my login page that I had recently uploaded to a live server, basically, the page was just reloading, and not doing anything. Question is here for reference:</p>

<p><a href="https://stackoverflow.com/questions/40982907/login-script-not-working-on-live-server">Login script not working on live server</a></p>

<p>After what seems like forever trying to figure out the problem, I had to send the form to another page to run the PHP without an isset in order to figure this out, and it works fine. I have found what is causing the issue, but don't understand why.</p>

<p>I don't want to have to change all of my code from isset to something else if it is not necessary… could it be different versions of PHP? my localhost is 5.6.15 and live server is 5.6.13, I didn't think it would've made such a difference.</p>

<p>For reference here is the code (it's also included in the previous question):</p>

<pre><code>&lt;?php
session_start();
$page_title = "Love Deals Login";
require('../inc/connect/config.php');
if($user-&gt;is_loggedin()!="") {
    header("Location: index.php");
}

if(isset($_POST['login'])) {
    $uname = $_POST['txt_uname'];
    $upass = $_POST['txt_upass'];

    if($user-&gt;login($uname,$upass)) {
        header("Location: index.php");
    } else {
        $error = "Login failed. Please try again, or register";
    }
}

include('inc/admin-header.php');
?&gt;
&lt;div class="container" style="padding: 100px 0 0 0;"&gt;
&lt;div class="form-container"&gt;
    &lt;form method="post" id="login" action="form-test.php"&gt;
        &lt;h3&gt;Please login&lt;/h3&gt;
        &lt;?php if(isset($error)) { ?&gt;
            &lt;div class="alert alert-danger"&gt;
                &lt;i class="glyphicon glyphicon-warning-sign"&gt;&lt;/i&gt; &amp;nbsp; &lt;?php echo $error; ?&gt;
            &lt;/div&gt;
        &lt;?php } else if(isset($_GET['joined'])) { ?&gt;
                &lt;div class="alert alert-info"&gt;
                    &lt;i class="glyphicon glyphicon-ok"&gt;&lt;/i&gt; &amp;nbsp; Thanks! You are now registered. You may now login below
                &lt;/div&gt;
        &lt;?php } else if(isset($_GET['pass-update'])) { ?&gt;
                &lt;div class="alert alert-info"&gt;
                    &lt;i class="glyphicon glyphicon-ok"&gt;&lt;/i&gt; &amp;nbsp; Success! Your password has been updated. You may now login below
                &lt;/div&gt;
        &lt;?php } ?&gt;
        &lt;div class="form-group col-xs-12 col-sm-10 col-sm-offset-1 col-md-8 col-md-offset-2 col-lg-6 col-lg-offset-3 login"&gt;
            &lt;input type="text" class="form-control" name="txt_uname" placeholder="Username" required /&gt;
        &lt;/div&gt;
        &lt;div class="form-group col-xs-12 col-sm-10 col-sm-offset-1 col-md-8 col-md-offset-2 col-lg-6 col-lg-offset-3 login"&gt;
            &lt;input type="password" class="form-control" name="txt_upass" placeholder="Password" required /&gt;
        &lt;/div&gt;
        &lt;div class="clearfix"&gt;&lt;/div&gt;
        &lt;div class="form-group col-xs-12 col-sm-10 col-sm-offset-1 col-md-8 col-md-offset-2 col-lg-6 col-lg-offset-3 login"&gt;
            &lt;p class="small text"&gt;Forgotten &lt;a href="forgot-user.php"&gt;Username&lt;/a&gt; / &lt;a href="forgot-pass.php"&gt;Password?&lt;/a&gt;&lt;/p&gt;
            &lt;button type="submit" name="login" class="btn btn-primary pull-right"&gt;
                &lt;i class="glyphicon glyphicon-log-in"&gt;&lt;/i&gt;&amp;nbsp;Login&lt;/button&gt;
        &lt;/div&gt;
        &lt;div class="col-xs-12 col-sm-10 col-sm-offset-1 col-md-8 col-md-offset-2 col-lg-6 col-lg-offset-3" style="text-align: center;"&gt;
            &lt;label&gt;Don't have an account yet? &lt;a href="agree.php"&gt;Register now&lt;/a&gt;&lt;/label&gt;
        &lt;/div&gt;
    &lt;/form&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;?php include('inc/admin-footer.php'); ?&gt;
</code></pre>

<p>All of the code is included in the previous question… works on localhost but not on live server. I also tried <code>!empty</code>, and <code>&amp;&amp; !empty</code>, but none work, but works in separate file with no if isset statement.</p>