How to submit a page to the same controller in CodeIgniter
Imagine you have a view with a <FORM> that need to submit to the same controller class. Probably you don’t want to hardcode the action attribute of your form nor leaving it in blank.
Using PHP_SELF could be a possible approach. However, since $_SERVER[‘PHP_SELF’] is a PHP server variable (nothing to do with CodeIgniter), you may encounter some problems with different environments.
So, why not to use the built-in CodeIgniter URI library? My solution to this problem is the following. Use $this->uri->uri_string() in conjunction with site_url().
Here is a simple example:
No related posts.





It seems that the example are missing on this page.
Istvan
17 Sep 09 at 6:51 am
Yes, you are right, for some reason this post has something missing. I’ll try to complete it for you again. Thanks and sorry for the inconvenience.
admin
17 Sep 09 at 9:55 am