Patrioticcow
Patrioticcow

Reputation: 27038

php, how to send a manual post within the zend framework?

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?

Upvotes: 1

Views: 714

Answers (1)

Mr Coder
Mr Coder

Reputation: 8186

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');

Upvotes: 2

Related Questions