CakePHP Controller Action only accessible to form
I have an action that collects membership requests on a site using CakePHP. This action resides in a controller called applications_controller.php
however the form itself is on my home page so a user cannot say access /applications/add
as it doesn't exist as a view just as a controller action. How can I make the action ONLY accessible to the form and if a use开发者_Go百科r tries to access it otherwise then it just does a 404 or redirects them to the home page?
Thanks
The simplest case is probably:
public function add() {
if ($this->data) {
// process the form data
}
$this->redirect('/');
}
精彩评论