Friday 15 February 2013

php - Code Igniter: Form's action cannot direct to the right path -


I am working on Code Igniter Project.

I have a php file in the View folder C: \ xampp \ htdocs \ mspn \ application \ views

The form has been written as: / P>

  & lt; Form action = "& lt;? Php echo base_url (). 'Home sign up / main';? & Gt; method =" post "& gt;   

In the browser, the file is located in localhost / mspn / index.php / signup / main

config.php I have:

  $ config ['base_url'] = 'localhost / mspn /'; $ Config ['index_page'] = ''; $ Config ['uri_protocol'] = 'auto';   

Form 'action' means in homeSignUp.php in the Controller folder that has a main .

But when I tried to run it, the submit button was directed to localhost / mspn / homeSignUp / main . And he said: The object was not found!

I am trying to change the URL to the action attribute, even then it gives me an error. What am i missing Thank you.

First of all, index_page config to: $ config ['index_page'] = 'index.php';

then like site_url () :

  & lt; Form action = "& lt;? Php echo site_url ('homeSignUp') / main ');? & Gt; method =" post "& gt;  Note:  It looks like you're using a specific  route , then you  signup / main  homeSignUp / main  Code instead  

Because the site url will include both base_url and index_url if any. You do not need to mention the index.php separator.

No comments:

Post a Comment