Posting of data in the database after a click of a button

Hi All,

I have created an a button in the frontent/views/views.php called Apply.Below is the code and look at 6940


<?= Html::a(‘Apply’, [‘apply’, ‘id’ => $model->order_id], [‘class’ => ‘btn btn-success’,

        ]) ?&gt;

    &lt;?= Html::a('Update', ['update', 'id' =&gt; &#036;model-&gt;order_id], ['class' =&gt; 'btn btn-primary']) ?&gt;

   &lt;?= Html::a('Delete', ['delete', 'id' =&gt; &#036;model-&gt;order_id], ['class' =&gt; 'btn btn-danger',

        'data' =&gt; [

            'confirm' =&gt; 'Are you sure you want to delete this item?',

            'method' =&gt; 'post',


    ]) ?&gt;

I want the moment I click the Apply button information on the view.php to be posted on a database table called bids.How can I do that.Please help.

I have two tables:available and bids.In the available controller I have an action called apply. I want the moment I click the action apply,data on the view to be inserted in a different table called bids.please help

You might find this helpful:

How can I select data from one table for example table available and insert it in a different table called bids using a single controller. please help

In your action:

$available = common\models\Available::find()->one();

$bid = new common\models\Bid;



Or if you want to skip the detour through ActiveRecord for performance reasons:

Hello all,

Look at the interface attached. I want the moment I click the apply button the information displayed that is order

-id,topic_title,discipline,pages,cost,and deadline to be posted in table called bids.The information on the view if fetched from a table called available.I want to use the same controller that is the available controller.

Please help this has been eating up my head for the last few days.


  • Topics merged

  • Please do not start a new topic with the same issue