title: Registration in codeigniter
body: <p>I am trying to register  in the following code. But when i register i got the error message  undefined variable base.</p>
  
  <p>View:</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;meta name="viewport" content="width=device-width, initial-scale=1.0" /&gt;
  &lt;link rel="stylesheet" type="text/css" href="&lt;?php echo $base?&gt;/&lt;?php echo $css?&gt;/style.css"&gt;
  &lt;link rel="stylesheet" href="&lt;?php echo $base?&gt;/&lt;?php echo $css?&gt;/bootstrap.min.css"&gt;
  
  &lt;script src="&lt;?php echo $base."/".$js?&gt;/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script src="&lt;?php echo $base."/".$js?&gt;/jquery.js"&gt;&lt;/script&gt;
  &lt;script src="&lt;?php echo $base."/".$js?&gt;/bootstrap.min.js"&gt;&lt;/script&gt;
  &lt;title&gt;Registration&lt;/title&gt;
  &lt;/head&gt;
  </code></pre>
  
  <p>Config.php</p>
  
  <pre><code>$config['base_url'] = 'http://localhost/ASOFT/Projects/CG_Pack';
  $config['site_url'] = 'http://localhost/ASOFT/Projects/CG_Pack/index.php';
  $config['css'] = 'assets/css';
  $config['js'] = 'assets/js';
  $config['image'] = 'assets/image';
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  class Home extends CI_Controller {
      var $data;
      function __construct(){
          parent::__construct(); 
          $this-&gt;load-&gt;library('form_validation');
          $this-&gt;load-&gt;helper('url');
      $this-&gt;load-&gt;model('user_model');
          $this-&gt;data = array(
          'site' =&gt; $this-&gt;config-&gt;item('site_url'),
               'base' =&gt; $this-&gt;config-&gt;item('base_url'),
               'css' =&gt; $this-&gt;config-&gt;item('css'),
              'js' =&gt; $this-&gt;config-&gt;item('js'),
              'image'=&gt;$this-&gt;config-&gt;item('image')
          );
  
      }
  
  public function index()
      {
          $data=$this-&gt;data;  
          $this-&gt;load-&gt;view('header',$data);
          }
  
  public function register()
  {
  $this-&gt;load-&gt;view('header');
  }
      public function do_register()
      {
      $this-&gt;load-&gt;library('form_validation');
      $this-&gt;form_validation-&gt;set_rules('uname', 'Username', 'required|min_length[4]|max_length[15]');
  
      $this-&gt;form_validation-&gt;set_rules('pass', 'Password', 'required|min_length[4]');
      $this-&gt;form_validation-&gt;set_rules('titleimg','Title','required|min_length[4]');
      $this-&gt;form_validation-&gt;set_rules('descrip', 'Description', 'required|min_length[4]');
  
  
      if($this-&gt;form_validation-&gt;run() == FALSE)
      {
  
  
              /*$this-&gt;load-&gt;view('header');  
  
      }
      else
      {
  
  
   $path = $_FILES['image']['name'];
  
   $imgext=strtolower(strrchr($path,'.'));
  
      $imgname= $this-&gt;generateRandomString().$imgext;
  
     if($path!='')
     {
  
     $im= $this-&gt;config-&gt;item('base_url').'/uploads'.'/'.$imgname;
     $x=$this-&gt;do_upload($imgname);
  
    $data['img']=$im;
  
  
      $this-&gt;user_model-&gt;register_user($data);
     $this-&gt;load-&gt;view('header',$data);
  
  }
  }
  }
  
   function generateRandomString()
    {
       $characters = '0123456789abcdefghijklmnopqrstuvwxyz';
       $randomString = '';
       for ($i = 0; $i &lt; 8; $i++) {
           $randomString .= $characters[rand(0, strlen($characters) - 1)];
       }
       return $randomString;
    } 
  
          function do_upload($img)
      {
          $config['upload_path'] = './uploads/';
          $config['allowed_types'] = 'gif|jpg|png';
          $config['max_size'] = '1024 ';
          $config['file_name'] = $img;    
          $this-&gt;load-&gt;library('upload',$config);
  
          if ( ! $this-&gt;upload-&gt;do_upload('image'))
  
          {
              $error = array('error' =&gt; $this-&gt;upload-&gt;display_errors());
              /*$data['error']=$error;
              return $data;*/
              return $error;
  
          }
          else
          {
  
              $data = array('upload_data' =&gt; $this-&gt;upload-&gt;data());
               return $data;
          }
          return;
      } 
  }
  </code></pre>
  
  <p>When i register  i got the error </p>
  
  <p>A PHP Error was encountered</p>
  
  <pre><code>Severity: Notice
  
  Message: Undefined variable: base_url
  
  Filename: views/header.php
  
  Line Number: 6
  
  Backtrace:
  
  File: C:\softwares\xamp\htdocs\ASOFT\Projects\CG_Pack\application\views\header.php
  Line: 6
  Function: _error_handler
  
  File: C:\softwares\xamp\htdocs\ASOFT\Projects\CG_Pack\application\controllers\home.php
  Line: 22
  Function: view
  
  File: C:\softwares\xamp\htdocs\ASOFT\Projects\CG_Pack\index.php
  Line: 293
  Function: include_once
  
  /assets/css/style.css"&gt;
  </code></pre>