-1

I'm practicing Codeigniter PHP Framework, also I'm very new to it. I have created View (login.php) in view folder of Framework. My issue is that I'm getting the following error:

Parse error: syntax error, unexpected end of file

Please check the code with what is the syntax error into it.

<h2>Login</h2>
<?php if($error==1){ ?>
<p>Your username / password did not match.</p>
<? } ?>
<form action="<?=base_url?>users/login" method="post">
    <p>Username: <input type="text" name="username" /></p>
    <p>Password: <input type="password" name="password" /></p>
    <p><input type="submit" value="Login" /></p>
</form>
Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
Harshad Patil
  • 100
  • 1
  • 14

1 Answers1

1

There are a few issues with your code.

Firstly, you are using short tag syntax when it hasn't been enabled on your system.

Consult the manual:

Then your form's action="<?=base_url?>users/login"

or as stated in comments action="<?php echo base_url ?>/users/login" with the extra slash.

You missed the () in order to declare it as a function.

  • base_url() is a function so you need to add the () to it, which is why you're getting the following error:

A PHP Error was encountered Severity: Notice Message: Use of undefined constant base_url - assumed 'base_url'

as stated in comments.

Additional documentation:

Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141