Domanda

So okay here's my problem. How do you make the url reset so that each execution of an action will make url overwrite. I'm using kohana 3.3.

Here's a sample scenario.

Base url:

localhost/kohana_app/

Registration Form

<form action="user/create" method="POST">

<input type="text" name="email" />

<input type="password" name="password" />

<input type="submit" value="Register" />

</form>

Submit button is pressed and redirects me to the login page, now url becomes.

localhost/kohana_app/user/create

Login Form

<form action="user/login" method="POST">

<input type="text" name="email" />

<input type="password" name="password" />

<input type="submit" value="Login" />

</form>

Now I press the login button then i get an error which is

View_Exception [ 0 ]: The requested view errors/404 could not be found

Surely this is expected since the full url is now.

localhost/kohana_app/user/user/login

How can i make it reset the url to the base so that every click of button it will overwrite the controller and action url?

Thanks and more power

È stato utile?

Soluzione

You'll need to put a base URL variable in at the start of your action. I've just had a look at the Kohana documentation, and it looks like you should do this:

<form action="<?=URL::base()?>/user/login" method="POST">
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top