title: how to convert angular js dynamic array into php array and submit array values into new php file
body: <p>can anybody suggest me how to convert angular js dynamic array into php array and then submit value of php array in any new file. in my program i am working in arraytest.php and want to send php array in saveform.php in php format. please anybody help me to do this. thanks</p>
  
  <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
   &lt;script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.1/angular.min.js"&gt;&lt;/script&gt;
  
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
  &lt;title&gt;Untitled Document&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;form name="myform" action="saveform.php" method="post"&gt;
  &lt;div ng-app="myApp" ng-controller="MyCtrl" data-ng-init="input.var1=input.var2=''"&gt; 
    &lt;div ng-repeat="input in inputs" &gt;
      &lt;input type="text" value="254" ng-model= "input.var1"/&gt;
          &lt;input type="text" ng-model="input.var2"/&gt;
     &lt;button type='button' ng-click='remove(input)'&gt;Remove&lt;/button&gt;
    &lt;/div&gt;
    &lt;div&gt;
      &lt;button type='button' ng-click='add()'&gt;Add&lt;/button&gt;
    &lt;/div&gt;
       &lt;p style="display:none"&gt;TotalDays = {{getTotal(value)}}&lt;/p&gt;&lt;br&gt;&lt;br&gt;
       &lt;div ng-repeat="dateTimeList in myarray"&gt;
              &lt;!--  first value:  &lt;input type ="text" value="{{ fir_value = dateTimeList.first }}"&gt;
                second value:   &lt;input type ="text" value="{{ sec_value = dateTimeList.second }}"&gt;--&gt;
                &lt;p&gt;{{ fir_value = dateTimeList.first }}&lt;/p&gt;
                &lt;p&gt;{{ sec_value = dateTimeList.second }}&lt;/p&gt;
                  &lt;?php 
                   $array1 = array("{{fir_value}}","{{sec_value}}"); 
                   print_r($array1); 
                  ?&gt;
  
       &lt;/div&gt;
  
       &lt;input type="submit" name="submit" /&gt;
  &lt;/div&gt;
  
  
  
  &lt;script&gt;
  angular.module('myApp', [])
  .controller('MyCtrl', function($scope) {
    $scope.inputs = [{}]; // default 1 sets
  
    $scope.add = function()
     {
      $scope.inputs.push({});
     }
  
    $scope.getTotal = function(a)
     {
  
  
          var total = 0,first_value=0,second_value=0, total2 = 0;
          $scope.myarray = [{}];
        angular.forEach($scope.inputs, function(value) 
        { // loop over array to process all items
              first_value = value.var1;
              second_value = value.var2;
              $scope.myarray.push({first:first_value,second:second_value});
        });
  return total;
  
    }
  
  // coding for remove button
    $scope.remove = function(item) {
      angular.forEach($scope.inputs, function(value, key) {
        if (value == item) {
          $scope.inputs.splice(key, 1);
        }
      });
    }
  });
  &lt;/script&gt;
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>here is another file saveform.php</p>
  
  <pre><code>&lt;?php
  echo "output of array is:- ";
  extract($_POST);
  if(isset($submit))
  {
  print_r($arr);
  }
  ?&gt;
  </code></pre>
  
  <p>plnkr demo: <a href="http://plnkr.co/edit/20PLT52Ia86UyGClQh7h?p=preview" rel="nofollow">http://plnkr.co/edit/20PLT52Ia86UyGClQh7h?p=preview</a></p>