Welcome Guest, Not a member yet? Register   Sign In
Error with version 2.0.2
#1

[eluser]Khaled Mahmud Tuhin[/eluser]
i am an amateur with codeigniter. i have managed to create a login from but after clicking login button no data can be seen.

in controller directory i have created code.php:
Code:
<?php class Code extends CI_Controller {

function __construct()
{
  parent::__construct();
  $this->view_data['base_url'] = base_url();
}
    
    public function index (){
        $this->load->view('index_code', $this->view_data);
        
        }
        function login()
        {
            
        echo "This is the out put" ;
        }
        
        
        }

in view directory i have created index_controller directory:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html &gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
Hello i Think this time i can do it.
Lets See about it
<h2>Log in to you Account</h2>
&lt;?php echo form_open(base_url() . 'login'); ?&gt;
<ul>
<li>
<label>username:</label>
<div>&lt;?php echo form_input(array('id' => 'username', 'name'=> 'username' )) ?&gt;
</li>

<li>
<label>password</label>
<div>&lt;?php echo form_input(array('id' => 'password', 'name'=> 'password' )) ?&gt;
</li>
<li> &lt;?php echo form_submit(array('name' =>'submit') ,'Login') ?&gt;</li>
</ul>
&lt;?php echo form_close(); ?&gt;


&lt;/body&gt;
&lt;/html&gt;
//i have also created
Code:
$autoload['helper'] = array('form','url');
please tell me what should i do.
#2

[eluser]a/\ekc[/eluser]
in controller directory create code.php:
Code:
&lt;?php class Code extends CI_Controller {

function __construct()
{
  parent::__construct();
  
}
    
    public function index (){
        echo "This is index page"."<br />" ;
        echo anchor('code/login','login');

        
        }
        function login()
        {
          $this->load->view('login');  
      
        }
        
        
        }

in view directory create login.php:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html &gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
Hello i Think this time i can do it.
Lets See about it
<h2>Log in to you Account</h2>
&lt;?php echo form_open(base_url() . 'login'); ?&gt;
<ul>
<li>
<label>username:</label>
<div>&lt;?php echo form_input(array('id' => 'username', 'name'=> 'username' )) ?&gt;
</li>

<li>
<label>password</label>
<div>&lt;?php echo form_input(array('id' => 'password', 'name'=> 'password' )) ?&gt;
</li>
<li> &lt;?php echo form_submit(array('name' =>'submit') ,'Login') ?&gt;</li>
</ul>
&lt;?php echo form_close(); ?&gt;


&lt;/body&gt;
&lt;/html&gt;

Code:
$autoload['helper'] = array('form','url');
#3

[eluser]InsiteFX[/eluser]
Code:
&lt;?php echo form_open('code/login'); ?&gt;

InsiteFX
#4

[eluser]Khaled Mahmud Tuhin[/eluser]
[quote author="InsiteFX" date="1309710060"]
Code:
&lt;?php echo form_open('code/login'); ?&gt;

InsiteFX[/quote]


my base url is
Code:
http://localhost/code/
#5

[eluser]osci[/eluser]
still you have a class code and function login so InsiteFX is right
#6

[eluser]InsiteFX[/eluser]
Your problem here is because you did not declare $data
Code:
&lt;?php class Code extends CI_Controller {

  private $view_data = array();

  function __construct()
  {
      parent::__construct();
      $this->view_data['base_url'] = base_url();
  }
    
  public function index ()
  {
     $this->load->view('index_code', $this->view_data);  
  }

  function login()
  {  
     echo "This is the out put" ;
  }
        
}

InsiteFX
#7

[eluser]Khaled Mahmud Tuhin[/eluser]
[quote author="InsiteFX" date="1309888906"]Your problem here is because you did not declare $data
Code:
&lt;?php class Code extends CI_Controller {

  private $view_data = array();

  function __construct()
  {
      parent::__construct();
      $this->view_data['base_url'] = base_url();
  }
    
  public function index ()
  {
     $this->load->view('index_code', $this->view_data);  
  }

  function login()
  {  
     echo "This is the out put" ;
  }
        
}

InsiteFX[/quote]


Quote:Not Found

The requested URL /code/login was not found on this server.
#8

[eluser]InsiteFX[/eluser]
Show your config.php base_url, I'll bet that it is incorrect. You should not be getting that error if your base_url is setup correct!

Also show your CodeIgniter directory structure.

InsiteFX
#9

[eluser]Khaled Mahmud Tuhin[/eluser]
[quote author="InsiteFX" date="1309894189"]Show your config.php base_url, I'll bet that it is incorrect. You should not be getting that error if your base_url is setup correct!

Also show your CodeIgniter directory structure.

InsiteFX[/quote]


this is my base url

Code:
$config['base_url']    = 'http://localhost/code/';
#10

[eluser]InsiteFX[/eluser]
Is code a direcory? If so I am not sure but maybe it is conflicting with the controller being named code.

base_url should be localhost/ci_directory_name You can also leave it blank and CI will try to figure it out!

Are you using an .htaccess file if so try doing away with it and see if it will run.

InsiteFX




Theme © iAndrew 2016 - Forum software by © MyBB