title: Yii2 - Bad Request (#400) Unable to verify your data submission
body: <p>My yii2 application was working fine till yesterday however today on submiting form it is showing error. "Bad Request (#400) Unable to verify your data submission.".</p>
  
  <p>I found many such questions on stackoverflow, where people are suggesting to disable csrf validation i tried disabling csrf validation also. i even updated my composer still it is not working.</p>
  
  <p>please suggest any other possible solution.</p>
  
  <p>This is my form code :-</p>
  
  <pre><code>&lt;h2&gt;Open an Account&lt;/h2&gt;
                    &lt;?php
                      $form = ActiveForm::begin([
                              'id' =&gt; 'live-account-form',
                              'enableClientValidation' =&gt; true,
                              'fieldConfig' =&gt; [
                                  'template' =&gt; '{input}{error}',
                                  'options' =&gt; [
                                      'tag' =&gt; false,
                                  ]
                              ],
                              'options' =&gt; [
                                  'class' =&gt; 'form-horizontal'
                              ]
                          ]);
                    ?&gt;
  
                    &lt;div class="form-group"&gt;
                      &lt;label for="signupform-first_name" class="col-sm-3 control-label"&gt;First Name*&lt;/label&gt;
                      &lt;div class="col-sm-9 field-signupform-first_name"&gt;
                          &lt;?= $form-&gt;field($model, 'first_name')-&gt;textInput(['placeholder' =&gt; "Enter First Name"]) ?&gt;  
  
                      &lt;/div&gt;
                    &lt;/div&gt; 
  
                    &lt;div class="form-group"&gt;
                      &lt;label for="singupform-last_name" class="col-sm-3 control-label"&gt;Last Name*&lt;/label&gt;
                      &lt;div class="col-sm-9 field-signupform-last_name"&gt;
                          &lt;?= $form-&gt;field($model, 'last_name')-&gt;textInput(['placeholder' =&gt; 'Enter Last Name']) ?&gt; 
                      &lt;/div&gt;
                    &lt;/div&gt;   
  
                    &lt;div class="form-group"&gt;
                      &lt;label for="signupform-email" class="col-sm-3 control-label"&gt;Email*&lt;/label&gt;
                      &lt;div class="col-sm-9 field-signupform-email"&gt;
                          &lt;?= $form-&gt;field($model, 'email')-&gt;textInput(['placeholder' =&gt; "Enter Email Address"]) ?&gt;
                      &lt;/div&gt;
                    &lt;/div&gt;
  
                    &lt;div class="form-group"&gt;
                      &lt;label for="signupform-country" class="col-sm-3 control-label"&gt;Country*&lt;/label&gt;
                      &lt;div class="col-sm-9 field-signupform-country"&gt;
                          &lt;?= $form-&gt;field($model, 'country')-&gt;dropDownList(
                              ArrayHelper::map(PhCountry::find()-&gt;all(), 'intid', 'country_name'),
                              [
                                  'prompt' =&gt; 'Select Country',
                                  'onchange' =&gt; '$( "select#signupform-country_code" ).html("showLoading");
                                      $.get( "index.php/site/fetch-country-code?id='.'"+$(this).val(), 
                                      function(data) {
                                          $( "#signupform-country_code" ).val(data);
                                      });'
                              ]
                          ) ?&gt;
                      &lt;/div&gt;
                    &lt;/div&gt;
  
                    &lt;div class="form-group"&gt;
                        &lt;label class="col-sm-3 control-label"&gt;Phone Number*&lt;/label&gt;
                        &lt;div class="col-sm-9 phone-number-div"&gt;
                          &lt;div&gt;
                          &lt;?= $form-&gt;field($model, 'country_code')-&gt;textInput(['placeholder' =&gt; 'Code', 'class' =&gt; 'country-code form-control']) ?&gt;
                          &lt;/div&gt;
                          &lt;div class="field-signupform-phone"&gt;
                          &lt;?= $form-&gt;field($model, 'phone')-&gt;textInput(['placeholder' =&gt; 'Enter Phone Number', 'class' =&gt; 'enter-phone-number form-control']) ?&gt;
                          &lt;/div&gt;
                        &lt;/div&gt;
                      &lt;/div&gt;
  
                      &lt;button type="submit" class="btn btn-default"&gt;Create Account&lt;/button&gt;
                    &lt;?php
                      ActiveForm::end();
                    ?&gt;
  </code></pre>
  
  <p>and this is my action code inside controller:-</p>
  
  <pre><code>public function actionIndex()
  {
      Yii::$app-&gt;controller-&gt;enableCsrfValidation = false;
      $model = new SignupForm();
      if ($model-&gt;load(Yii::$app-&gt;request-&gt;post())) {
          //print_r($model);
          if ($user = $model-&gt;signup()) {
              if($model-&gt;sendRegistrationEmail($user)) {
                  Yii::$app-&gt;session-&gt;setFlash('emailSent', 'An email containing confirmation link is sent to your email Address.');
                  if (Yii::$app-&gt;getUser()-&gt;login($user)) {
                      return $this-&gt;goHome();
                  }    
              } 
          }
          //exit;
      }
  
      return $this-&gt;render('index', [
          'model' =&gt; $model,
      ]);
  }
  </code></pre>