title: Yii2 - Save current database field value in php variable
body: <ol>
  <li>I'm making an online store in Yii2.</li>
  <li>I have a mysql table called products for displaying products in a
  view. This table belongs to ProductsController and Products model. The view uses a ListView and $dataProvider to show a product picture and some relative text and int values, such as name, price, etc. ... It also as in every record displayed a button to purchase.</li>
  <li>When i click the purchase button it then goes to another controller called EncomendasController and another view which as another table called Encomendas and it's form fields where the client input it's personal data (name, address, etc. ...).</li>
  <li>What i need to do is: when the client clicks in ProductsController view the button to purchase an item from the listView only that item field name must be stored, perhaps in a variable, and in the new view that is related to EncomendasController the product chosen name will display above the fields that gather the client personal data to finalize the selling process.</li>
  </ol>
  
  <p><strong>Any ideas?</strong></p>
  
  <p><strong>EDIT - detailView with purchase button</strong></p>
  
  <pre><code>&lt;?= DetailView::widget([
      'model' =&gt; $model,
      'options' =&gt; ['class' =&gt; 'detail1-galeria-view2'],
      'attributes' =&gt; [
          // cria um array com a fotografia, em que carrega a path no campo fieldName da bd
          [
              'attribute'=&gt;'',
              //'value'=&gt;$model-&gt;foto,
              'value'=&gt;Html::a(Html::img(Yii::$app-&gt;getUrlManager()-&gt;getBaseUrl() . "/" .$model-&gt;foto, ['width'=&gt;'192', 'height' =&gt; "256"]), $model-&gt;foto),
              'format' =&gt; 'raw',
          ],
          [
          'attribute'=&gt;'',
          'value'=&gt;$model-&gt;nome,
          ],
          [
          'attribute'=&gt;'',
          'value'=&gt;$model-&gt;categoria,
          ],
          [
          'attribute'=&gt;'',
          'value'=&gt;$model-&gt;descricao,
          ],
          [
          'attribute'=&gt;'',
          'value'=&gt;$model-&gt;valor.' '.'€',
          ],
          // info
          [
          'attribute'=&gt;'',
          'format' =&gt; 'raw',
          'value'=&gt; Html::a(Yii::t('app','PURCHASE'), Url::toRoute(['encomendas/create'])),
          ],
      ],
  ]) ?&gt;
  </code></pre>