Codeigniter and Form

361 Views Asked by At

I have a problem with Codeigniter and my hosting provider...

I have created a form with function form_open('welcome/index') and it produces this html code <form action="http://gggg.com/index2.php/welcome/index" method="post"> but this doesn't work, infact when I submit the form I will return in the same page without effects.

I have to say that there are no errors in the code, because it works in localhost and works also if I write form_open('http://gggg.com/index2.php/welcome/index').

So, in summary if I write: form_open('welcome/index'), it doesn't work else if I write: form_open('http://gggg.com/index2.php/welcome/index'), it works

It's very strange, can anybody help me?

2

There are 2 best solutions below

1
On

It would help to know what URL it is actually sending the form data to.

You need to look through your config file. Make sure the correct values are set for:

$config['base_url'] = "http://gggg.com/";
$config['index_page'] = "index2.php";

Also make sure you htaccess files are correct, if you are running on Apache.

1
On

If you are not modified your htaccess to allow URLs like http://ggg.com/controller/function/param1, you should always add 'index2.php' and the beginning of all of your URLs.

Try to modify using form_open('index2.php/welcome/index').

Anyways, check your config.php file just how Michael told you.