Send form data to mysql with Angular

Im Using ionic framework. And I have written a code to send the form data of an ionic application with angularjs to mysql. My code works fine, but only empty records are inserted to mysql These are the codes:

form.html

<div class="list"> 
<form>
<div><input type="text" ng-model="h" ></div>
<div><input type="text" ng-model="s"></div>

<button ng-click='SignUp();'>SignUp</button>
</form>
</div>

Controller

.controller('SearchCntrl', function($scope, $http) {

 $scope.SignUp = function() {

 $http.post('http://www.qatarperfectmedia.com/channel/postdata.php',
 {'h':$scope.h, 's':$scope.s}
 ).success(function(data, status, headers, config) {

    if (data.msg != '')
       {
         $scope.msgs.push(data.msg);
       }
    else
       {
         $scope.errors.push(data.error);
       }
      }).error(function(data, status) {
         $scope.errors.push(status);
       });
}
})

The problem i face is when form submitted, only empty records are being inserted to database. Thnk you

Is your data reaching the server correctly?

You should use the web inspector and see if the parameters are passed to the server as you want it to be.

You should check if you are expecting a POST or a GET in the server side also.

Data is empty when it reaches the server.

You can try to add “Content-Type” header to the post request.
Or maybe you just met this issue: https://github.com/angular/angular.js/issues/6039#issuecomment-34017238

Can you post your PHP? That is half the puzzle! I write my API’s in PHP so I can try and help debug what that may be doing as well.

BTW you don’t have to use quotes around your property declarations for the data portion. It will encode it correctly via the headers you use.