Form not POST ing

this is my view where there is a form containig a field and a submit button.


 <form id="typeheadForm" method="post" class="form-horizontal" action="<?php echo \Yii::$app->getUrlManager() ->createUrl( [ 'movies/movies_all', ] )?>">          

  <div class="form-group">                

<label class="col-xs-3 control-label">Movie</label>              

  <div class="col-xs-3">                

   <input type="text" class="form-control" name="state" id="movie_name" />              

  </div>          

  </div>                 

	<input type="submit" name="submit" value="Search" class="btn btn-squared btn-default">       

 </form> 

and below is my controller code


    

 public function actionMovies_all()   {           

     $this->layout = "main";             

   if ( isset( $_POST[ 'movie_name' ] ) )    

 {    		  

   print_r("success");die();    		 

   }               

 if ( Yii::$app->request->post() ) 

  {                 

 print_r(Yii::$app->request->post());die();           

    }   

  }

i am not able to POST the form. what am i doing wrong?i am getting an error " Bad Request (#400)Unable to verify your data submission."

Hi!

Since you do not use ActiveForm I would say the problem is CSRF validation.

When I’m not wrong you have 3 options:

  1. Disable CSRF validation for the controller or action which is processing your request.

  2. Implement CSRF validation for your form.

  3. Use ActiveForm to have CSRF validation automatically handled by yii.

Read (there is everything explained):

Regards

thanks yes csrf validation was my problem