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:


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

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


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

 $scope.SignUp = function() {

 {'h':$scope.h, 's':$scope.s}
 ).success(function(data, status, headers, config) {

    if (data.msg != '')
      }).error(function(data, 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:

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.