0

Hi for some reason i keep getting a parse error when i try to load my view could someone tell me why it says unexpected end to file on line 20

<section id="login-landing" class="block block-gray">
    <div class="container">
        <div class="card card-container wow zoomInUp animated">
            <a href="<?php echo base_url()?>">
                <img id="profile-img" class="profile-img-card" src="<?php echo base_url();?>assets/img/site/main.png"
                class="img-responsive">
            </a>
            <p id="profile-name" class="profile-name-card">Administrator Login</p>
            <?php if($error == 1){ ?>
                <p>The username and password did not match!</p>
            <? } ?>
            <form action="<?php echo base_url()?>users/login" method="post" class="form-signin">
                <input type="text" id="username" class="form-control" placeholder="Username" autofocus>
                <input type="password" id="password" class="form-control" placeholder="Password">
                <input type="submit" class="btn btn-lg btn-primary btn-block btn-signin" value="Sign In"></button>
            </form><!-- /form -->
            <a href="#" class="forgot-password"> Forgot your password</a>
        </div><!-- /card-container -->
    </div><!-- /container -->
</section>
4
Contributors
5
Replies
35
Views
1 Year
Discussion Span
Last Post by lps
0

When i add the <?php on line 11 it shows the error on page load not on execution of the form?

0

Try the following change:

<?php if($error == 1){
    echo "<p>The username and password did not match!</p>";
} ?>

and replace lines 9 to 11 with it. HTML is always executed on the page, and you had the HTML outside the PHP so it was always written. This change will make it so that HTML will only be written if the $error == 1 Please let us know if there are more problems.

0

Here is the code that I found working after modify from yours:

<?php
function base_url(){
    return "www.google.com/";
}
try {
    ?>
    <section id="login-landing" class="block block-gray">
        <div class="container">
            <div class="card card-container wow zoomInUp animated">
                <a href="<?php echo base_url(); ?>">
                    <img id="profile-img" class="profile-img-card" src="<?php echo base_url(); ?>assets/img/site/main.png" class="img-responsive"/>
                </a>
                <p id="profile-name" class="profile-name-card">Administrator Login</p>
                <?php if ($error == 1) { ?>
                    <p>The username and password did not match!</p>
                <?php } ?>
                <form action="<?php echo base_url() ?>users/login" method="post" class="form-signin">
                    <input type="text" id="username" class="form-control" placeholder="Username" autofocus>
                    <input type="password" id="password" class="form-control" placeholder="Password">
                    <input type="submit" class="btn btn-lg btn-primary btn-block btn-signin" value="Sign In"></button>
                </form><!-- /form -->
                <a href="#" class="forgot-password"> Forgot your password</a>
            </div><!-- /card-container -->
        </div><!-- /container -->
    </section>
    <?php
} catch (Exception $e) {
    echo 'Caught exception: ', $e->getMessage(), "\n";
}
?>

Modify accordingly with comparism with yoru code.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.