1

im not sure if the question was framed correctly, but here is my situation:

i have two actions: indexAction and searchAction

a third action looks something like this:

public function customsearchAction()
{
    $request = $this->getRequest();
    if($request->isPost()){

        $category = $request->getParam('select_category');
        $searchString   = $request->getParam('header_search_form');

        if($category == 'index'){
            $this->_redirector->gotoSimple('index', 'index', null,
                                   array('term' => $searchString )
                                   );
        }
        if($category == 'search'){
            $this->_redirector->gotoSimple('search', 'index', null,
                                   array('term' => $searchString )
                                   );
        }
    }
}

this is fine and dandy, the only problem is that the redirect adds the term as a get string instead of a post like i need it.

any ideas?

Patrioticcow
  • 26,422
  • 75
  • 217
  • 337
  • possible duplicate of [Redirect to new page w/ POST data (PHP/Zend)](http://stackoverflow.com/questions/1309456/redirect-to-new-page-w-post-data-php-zend) –  May 16 '12 at 04:31
  • yes, it looks like is a duplicate, i saw that post but i wasn't sure that that example it takes any params. – Patrioticcow May 16 '12 at 04:36

1 Answers1

2

Browser redirect will always add term to GET for next request to process. What you can do here is use ZF MVC internal redirect using 'forward' .

$this->_forward('search','index',null,array('term' => $searchString ));

Inside your searchAction

$searchString = $this->_getParam('term');
Mr Coder
  • 8,169
  • 5
  • 45
  • 74