Welcome Guest, Not a member yet? Register   Sign In
form_open adds index.php to path
#1

Hi,
Using form_open('your/path') adds the index.php to the absolute path in the final HTML while using base_url('your/path') does not.
Posting form data is not working when I use .htaccess to remove index.php from the path AND index.php is part of the absolute path. 
I suggest removing index.php from all CI generated path in the future so all functions will output a path like base_url for consistency.

If you have the same problem as I had not being able to post form data using form_open() you can use the following code instead:
<form action="<?= base_url('your/path')?>" method="post" accept-charset="utf-8"> 

I use the following code in .htaccess to remove index.php and redirect:

#1) redirect the client from "/index.php/foo/bar" to "/foo/bar"
RewriteCond %{THE_REQUEST} /index\.php/(.+)\sHTTP [NC]
RewriteRule ^ /%1 [NE,L,R]
#2)internally map "/foo/bar" to "/index.php/foo/bar"
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [L]
Reply


Messages In This Thread
form_open adds index.php to path - by Fabatka - 12-07-2018, 02:56 AM
RE: form_open adds index.php to path - by kaitenz - 12-12-2018, 02:00 AM



Theme © iAndrew 2016 - Forum software by © MyBB