views:

43

answers:

2

Hello Good people

i'm trying to check whether my forms(Zend_Form) are being well processed and display whatever back to user, for testing (my way of learning new stuffs).So i've read online that there are 3 ways to accomplish this. one using the Zend_Registry which is unanimously said to be a bad practice.i'm now left with placeholder and _request.I've tried with the request like this:

public function createAction(){
 $this->view->show = "Please Enter your Details";

    $formentity = new Hotel_Form_Entity();
    $this->view->form = $formentity;
    if($this->getRequest()->isPost()){
      if($formentity->isValid($this->getRequest()->getPost())){
        $values = $formentity->getValues();
        $this->_helper->flashMessenger("Thank you.Form processed");

     $user = new Hotel_Model_User();
     //with this i got the values in the user table in the database.so i know that the actual data is passed.
      $user->name = $values["name"];
      $user->surname = $values["surname"];
      $user->save();


        $this->_redirect("/booking/user/success",$values);
      }
    }
}


public function successAction(){
   $this->view->message = $this->_helper->flashMessenger->getMessages();
    $this->view->data = $this->getRequest()->getParams();
  }
}

it's rather the request itself that i got like this via var_dump

array
'module' => string 'booking' (length=7)
'controller' => string 'user' (length=4)
'action' => string 'success' (length=7)

the success.phtml is like this :

<h4><?php echo implode($this->message); ?></h4><br/>
<?php var_dump($this->data); ?>

Can anyone please show me how achieve that?i can't explain why but this is not supposed to be a big deal.Thanks for reading

+1  A: 

You could send the params with the _redirect helper (second param must be an array)

$this->_redirect("/booking/user/success", $values);

in public function successAction(); $this->getRequest()->getParams();

ArneRie
Hello Thanks for responding.There is still something wrong because with your method it displays the request itself.i updated my post to depict that.
black sensei
A: 

Hello I think what ArneRie meant was rather

$this->_forward("success","user","booking",$values);

method.Solved my issue.Thanks to all

black sensei