0

I have a question. How to get date_from and date_to value from a URL in my view. I try to use Yii::$app->getRequest()->getQueryParam('date_from') but not get anything.

The URL:

localhost/..../index.php?r=installment%2Freport&InstallmentSearch%5Bdate_from%5D=2017-11-27&InstallmentSearch%5Bdate_to%5D=2017-11-27

1 Answer 1

3

Suggestion

if ($searchModel->load(Yii::$app->request->get())) {
    $dateFrom = $searchModel->date_from;
    $dateTo = $searchModel->date_to;
}

Using QueryParam()

Yii::$app->getRequest()->getQueryParam('InstallmentSearch')['date_from'];
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.