too long

<?php echo form_open('user_authentication/user_login_process'); ?>
<?php
echo "<div class='error_msg'>";
if (isset($error_message)) {
echo $error_message;
}
echo validation_errors();
echo "</div>";
?>
<label>UserName :</label>
<input type="text" name="username" id="name" placeholder="username"/><br /><br />
<label>Password :</label>
<input type="password" name="password" id="password" placeholder="**********"/><br/><br />
<input type="submit" value=" Login " name="submit"/><br />
<a href="<?php echo base_url();?>login_form">To SignUp Click Here</a>
<?php echo form_close(); ?>

The code above is for the login form. I want this to be redirected to the user_registration page, however below is the error I receive.

Login Form

UserName : username

Password : **********

Login

( ! ) Fatal error: Call to undefined function base_url() in C:\wamp\www\login\application\views\login_form.php on line 46 Call Stack #TimeMemoryFunctionLocation 10.0011403408{main}( )..\index.php:0 20.0042497640require_once( 'C:\wamp\www\login\system\core\CodeIgniter.php' )..\index.php:315 30.03892976408call_user_func_array ( )..\CodeIgniter.php:532 40.03892976576User_Authentication->index( )..\CodeIgniter.php:532 50.03892976728CI_Loader->view( )..\user_authentication.php:26 60.03892977168CI_Loader->_ci_load( )..\Loader.php:489 70.03943031736include( 'C:\wamp\www\login\application\views\login_form.php' )..\Loader.php:962
A PHP Error was encountered

Severity: Error

Message: `Call to undefined function base_url()`

Filename: `views/login_form.php`

Line Number: 46

Backtrace:
  1. Did you add the URL helper in your controller like so:

    $this->load->helper('url');
    
  2. If that does not work, then replace your echo base_url(); with

    echo load_class('Config')->config['base_url'];
    
  3. Use site_url(), which also requires you to add the url helper in your controller like i mentioned in point 1.

You need to load the url helper in order to use base_url() function

Method 1 :

you can load the helper in controller like below

$this->load->helper('url');

Method 2 :

We can atuload url helper and it will be available throughout the application. For this in application\config\autoload.php modify as follows -

$autoload['helper'] = array('url'); 

Read Documentation