title: AngularJS How to insert multiple record once in Mysql using PHP
body: <p>I am a newbie in AngularJS, I am trying to figure out how to save record on button click. </p>
  
  <p>Here is a code: </p>
  
  <pre><code> &lt;div ng-controller="appController"&gt;   
      &lt;table class="table"&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Country&lt;/th&gt;
      &lt;th&gt;Phone Number&lt;/th&gt;
      &lt;th&gt;Display in country&lt;/th&gt;
  
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
  
  
    &lt;tr ng-repeat="num in nums"&gt;
  
            &lt;td&gt;{{num.country}}&lt;/td&gt;
            &lt;td&gt;{{num.phone}}&lt;/td&gt;
           &lt;td&gt;
            &lt;select name="display_country[]"&gt;
                &lt;option value="US"&gt;United State of America&lt;/option&gt;
                &lt;option value="AU"&gt;Australia&lt;/option&gt;
            &lt;/select&gt;
  
            &lt;/td&gt;
  
    &lt;/tr&gt;
   &lt;tr&gt;
     &lt;td colspan="3"&gt;
      &lt;button type="button" class="btn btn-success"&gt;Submit&lt;/button&gt;
     &lt;/td&gt;
   &lt;/tr&gt;
  
  &lt;/tbody&gt;
  </code></pre>
  
  <p>
    </p>
  
  <p>It will give output show in attachment <a href="https://i.stack.imgur.com/eigEJ.png" rel="nofollow noreferrer">Please see this screenshot of output</a></p>
  
  <p><img src="https://i.stack.imgur.com/eigEJ.png" alt=""></p>
  
  <p>I need to save  country, phone, and selected country from drop-down box into my MySQL database when user click on the button</p>
  
  <p>Controller code</p>
  
  <pre><code>          var fetch = angular.module('dinapp', ['ui.select2']);
  
            fetch.controller('appController', ['$scope', '$http', function           ($scope, $http) {
            $scope.list_of_string = ['tag1', 'tag2']
            $scope.select2Options = {
            'multiple': true,
            'simple_tags': true,
            'tags': ['tag1', 'tag2', 'tag3', 'tag4']  // Can be empty list.
       };
  getNumbers();
  function getNumbers(){
  
      $http({
      method: 'GET',
          url: 'server/index.php?type=fetchrecord',
          data: { 'type' : 'fetchrecord' },
          //headers: {'Content-Type': 'application/x-www-form-urlencoded'}
      }).then(function successCallback(response) {
      // Store response data
  
          $scope.nums = response.data;
      });
  
  },
  $scope.save = function () {
  
  }   
  
    }]);
  </code></pre>