Reputation:
I'm getting started with Zend Framework and MVC more widely and i can't manage to redirect the user in case he has entered something in the form...
<?php
class adresseController extends Zend_Controller_Action {
public function init() {
global $config;
$protocol = strtolower(substr($_SERVER["SERVER_PROTOCOL"], 0, 5)) == 'https' ? "https://" : "http://";
$this->view->url = $protocol . $config->app->url;
}
public function adresseAction() {
//Si la méthode isPost() de l'objet de requête renvoie true, alors le formulaire a été envoyé.
if ($this->getRequest()->isPost()) {
//récupération des données
$prenom = $form->getValue('prenom');
if($prenom == "arnaud")
{
$this->_helper->redirector("inscription/index");
}
}
}
}
?>
Field in question in my HTML form:
<div><input type="text" name="prenom" value="" title="Prénom *" class="small error"/>
inscription/index is the name of the view i want to be redirected to.
thanks in advance for your help
Upvotes: 0
Views: 84
Reputation: 7404
If you want to redirect to URL then use this :
$this->_redirect("/inscription/index");
And if you want to redirect to controller then you are already using that :
$this->_helper->redirector('action', 'controller');
Upvotes: 1