Reputation: 37
I have this code in my view page:
<?php if(isset($journal)&&($keyword=="%")){
return Yii::$app->controller->runAction('journalslist', ['publisherID'=>$journal['publisher_id'], 'partial'=>1]);
}
How can I get 'publisherID'
and 'partial'
in actionJournalList()
in the controller?!!! var_dump($_POST)
shows empty array and Yii::$app->getRequest()->getQueryParams()
just have $_GET
data? How can I config runAction
to POST data?
Any help would be appreciated!
Upvotes: 0
Views: 79
Reputation: 504
As far as I know there shouldn't really be a reason to ever call runAction explicitly as it does not match up with the MVC design.
Explain what you're trying to achieve overall and you'll find a better answer. For now i'd say, look at the current controller/action that is rendering that view and have it check if(isset($journal)&&($keyword=="%")){
and route the information from the existing action to your view instead of trying to call a new action.
Alternatively run a redirect.
Upvotes: 1
Reputation: 8033
POST method is only for form
. If you redirect to an action, This means GET. There is no way for redirecting with POST. $_POST
will be filled only when you submit a form.
Upvotes: 1