title: Yii 2: new form to pass variables to another view with post
body: <p>with yii 2 i want to pass 3 variables from a view to another view. In my controller i've created an action that get this 3 variables and then open a view, but in the &quot;start&quot; view i can't write a working form :/</p>
  <p>This is my starting view:</p>
  <pre><code>&lt;?= Html::beginForm(['preview', 'type'=&gt;0, 'start'=&gt;'start', 'end'=&gt;'end'], 'post', ['enctype' =&gt; 'multipart/form-data']) ?&gt;
  
                  &lt;?=
                      \yii\widgets\MaskedInput::widget([
                          'name' =&gt; 'start',
                          'clientOptions' =&gt; ['placeholder' =&gt;  'GG-MM-AAAA'],
                          'mask' =&gt; '99-99-9999',
                      ])
                  ?&gt;
  
                  &lt;?=
                  \yii\widgets\MaskedInput::widget([
                      'name' =&gt; 'end',
                      'clientOptions' =&gt; ['placeholder' =&gt;  'GG-MM-AAAA'],
                      'mask' =&gt; '99-99-9999',
                  ])
                  ?&gt;
  
                  &lt;?= Html::submitButton('Go', ['class' =&gt; 'submit']) ?&gt;
  
  &lt;?= Html::endForm() ?&gt;
  </code></pre>
  <p>and this is my action:</p>
  <pre><code>public function actionPreview($type, $start, $end)
  {
      return $this-&gt;redirect(['preview', 'type' =&gt; $type, 'start'=&gt;$start, 'end'=&gt;$end]);
  }
  </code></pre>
  <p>But, when i push the button &quot;Go&quot;, Yii 2 returns</p>
  <blockquote>
  <p>Bad Request (#400) - Missing required parameters: start,end</p>
  </blockquote>
  <p>I've tried also this action:</p>
  <pre><code>public function actionPreview() //$type, $start, $end
  {
      $post = Yii::$app-&gt;request-&gt;post();
      $type = $post['type'];
      $start = $post['start'];
      $end = $post['end'];
      return $this-&gt;redirect(['preview', 'type' =&gt; $type, 'start'=&gt;$start, 'end'=&gt;$end]);
  }
  </code></pre>
  <p>But it returns this error:</p>
  <blockquote>
  <p>Undefined index: type /start / end</p>
  </blockquote>
  <p>Any ideas?</p>
  <p><strong>-------UPDATE--------</strong></p>
  <p>Now rendering works, but i can't read the params from the starting view.</p>
  <p>MyController:</p>
  <pre><code>public function actionPreview() //$type, $start, $end
  {
      $type = Yii::$app-&gt;request-&gt;get('type');
      $start = Yii::$app-&gt;request-&gt;get('start');
      $end = Yii::$app-&gt;request-&gt;get('end');
      return $this-&gt;render('preview', [
          'type' =&gt; $type, 'start'=&gt;$start, 'end'=&gt;$end
      ]);
  }
  </code></pre>
  <p>The Form in my View is the same that you can see above, but it sends generic params to next page (in short, it doesn't read the input field):</p>
  <blockquote>
  <p>start=start</p>
  <p>end=end</p>
  </blockquote>