Welcome Guest, Not a member yet? Register   Sign In
url in form_open()
#1

[eluser]vickatg[/eluser]
hello,
i am having a problem in directing my login form in an appropriate page. ie

<?php echo form_open('login/process', array('class' => 'normal_form') ); ?>

i want to direct my form in a controller process.php. my form is located in the view folder.

do i have to use "/application/controller/login/process" ?
#2

[eluser]vickatg[/eluser]
application/controllers/login/process
#3

[eluser]toopay[/eluser]
specify the function, if you put the validation outside 'index' function
Code:
<?php echo form_open('login/process/some_function',  array('class' => 'normal_form') ); ?>
#4

[eluser]vickatg[/eluser]
my validation is inside the index function, but whenever i check the directed url on the address bar
it looks http://localhost/myproject/login/process while my controller is in

http://localhost/myproject/application/c...in/process are my configuration wrong?
#5

[eluser]toopay[/eluser]
Your controller file, is in '/application/controllers/' directory, but to access that, normally it would be 'http://localhost/myproject/login/process'. I think the redirect function is fine, but i bet it generates 404 error CI now.

Do a search, there are bunch same problems which have been solved. Your problems could be about 'removing index.php'. Also, you may found this thread help you.
#6

[eluser]vickatg[/eluser]
i have followed a couple of discussions on this forums yet i haven't succeeded.

below is the error generated

The requested URL /myproject/login/process was not found on this server.
any other tips to get things done?
#7

[eluser]toopay[/eluser]
create a '.htaccess' file and put in same level with index.php. Write this inside it :
Code:
RewriteEngine On
RewriteBase /myproject/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) /myproject/index.php?/$1
#8

[eluser]vickatg[/eluser]
sorry if i am asking too much, it's that am still new with this framework.

i changed the .htaccess file into the one you suggested, yet the full path is not generated.

this is the full scenario

my form is in /views/login/form_login.php and my controller is in

/controllers/login/process.php

this is the opening form tag

<?php echo form_open('login/process', array('class' => 'normal_form') ); ?>

when i click the send button below is the error i get

Not Found
The requested URL /myproject/login/process was not found on this server.
Apache/2.2.16 (Ubuntu) Server at localhost Port 80

what i observe is that the full path is not generated on the url bar of the browser. and i have set the .htaccess file as you instructed. from that picture can you tell me where i could be going wrong?
#9

[eluser]toopay[/eluser]
We change the .htaccess in order to tell the apache, that every request which matches with the criteria is redirect to your index.php, NOT TO achieve '/controllers/login/process.php' which is not the corect path to your controller!

Ok, whats happens if you access this address in your browser :

1. http://localhost/myproject/
2. http://localhost/myproject/index.php/login/process
#10

[eluser]vickatg[/eluser]
with

http://localhost/myproject/ i get the interface of my system

with

http://localhost/myproject/index.php/login/process

i access the process.php controller

if with those am getting the right output.

now whats wrong when am posting the form?




Theme © iAndrew 2016 - Forum software by © MyBB