I am submitting form using form helpers and it's going to blank page and when I see the view source, the action in the view source is like this http://::1/ci1/login_validation
I don't understand the ::1
in it shouldn't it be localhost:8080/
? But if I use simple form tags like regular html it works fine?
<?php
echo form_open ('login_validation');
echo form_input('email');
echo form_password('password');
echo form_submit('login_submit', 'login');
echo form_close();
?>
View Source
<form action="http://::1/ci1/login_validation" method="post" accept-charset="utf-8">
<p>Email:<input type="text" name="email" value="" /></p>
<p>Password:<input type="password" name="password" value="" /></p>
<p><input type="submit" name="login_submit" value="login" /></p>
</form>
I would think it is a couple of thing like.
If your form action has http://::1/
then does not submit correct because base url is empty
$config['base_url'] = '';
Fill base url example:
$config['base_url'] = 'http://localhost/project_name/';
On codeigniter 3 version not best idea to leave it blank because you will run in to that issue.
Make sure your class and file names of controllers etc have first letter upper case.
Filename: Login_validation.php
Controller:
<?php
class Login_validation extends CI_Controller {
public function index() {
// form submit controller code.
}
}
View
<?php
echo form_open ('login_validation');
echo form_input('email');
echo form_password('password');
echo form_submit('login_submit', 'login');
echo form_close();
?>
This is a common mistake people for get to check.
Why http://::1/
??
This mean your base_url()
is empty.
Then how this http://::1/
comes??
When your project URL is empty, CI detect your project URL. So this http://::1/
knows your project path.
How to set base_url()
??
In config/config.php
set $config['base_url'] = '';
the project URL.
Keeping base_url()
empty any harm??
When you in local its ok and fine. But when you host that just add your site URL to it.
$config['base_url'] = 'www.stackoverflow.com';