title: Updating a record in Yii 2
body: <p>Diving into this new yii 2 and Im already stuck. Im trying update a user record with a form. The original record is loading in the form, but changing the values in the form is not updating the record.</p>
  
  <pre><code>public function actionUserprofile()
  {
      $id = Yii::$app-&gt;user-&gt;identity-&gt;id;
      $model = User::find()-&gt;where(['id' =&gt; $id])-&gt;one();
  
      if($model-&gt;load(Yii::$app-&gt;request-&gt;post()) &amp;&amp; $model-&gt;save())
      {
          Yii::$app-&gt;session-&gt;setFlash('success','You have updated your profile.');
  
      }
         return $this-&gt;render('userProfile', [
          'model' =&gt; $model,
      ]); 
  
  
  
  }
  
  //view form
  &lt;div&gt;
  
  &lt;?php $form = ActiveForm::begin(); ?&gt;
  &lt;?= $form-&gt;field($model, 'username')-&gt;textInput(['maxlength' =&gt; 255]) ?&gt;
  &lt;?= $form-&gt;field($model, 'first_name')-&gt;textInput(['maxlength' =&gt; 255]) ?&gt;
  &lt;?= $form-&gt;field($model, 'last_name')-&gt;textInput(['maxlength' =&gt; 255]) ?&gt;
  &lt;div class="form-group"&gt;
      &lt;?= Html::submitButton('Submit',['class'=&gt;'btn btn-success']) ?&gt;
  &lt;/div&gt;
  &lt;?php ActiveForm::end(); ?&gt;
  </code></pre>
  
  <p></p>