Im creating and mobile app with angularjs and php of recipes. Im trying to send the id from the recipe from the url using the $stateParams of angular to the server with http POST method. The Id is send it or received wrong because when I check the data in my localhost shows me an empty object. Anyone knows what error Im committing?
Angularjs:
-Controller for the view:
.controller('RecipeDetailCtrl', function($scope, $stateParams, Recipes) {
  Recipes.getRecipe($stateParams.recipeId).success(function(data){
        $scope.recipe = data;
        console.log($scope.recipe);
    })                                                
})
-Function in services.js:
   getRecipe : function(Id) {
        return $http({
            url: 'http://localhost/degusto/detail.php',
            method: 'POST',
            data: {'Id': Id},
            headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
     }) 
  }
PHP:
   require_once("connect.php");
   $user_id = $_POST['Id'];
   echo "user_id:"+$user_id;
   $result = $conn->query("SELECT * FROM Recipes WHERE Id ='".$var."'");
   $outp = "[";
    while($rs = $result->fetch_array(MYSQLI_ASSOC)) {
       if ($outp != "[") {$outp .= ",";}
       $outp .= '{"Id":"'  . $rs["Id"] . '",';
       $outp .= '"Name":"'   . $rs["Name"]        . '",';
       $outp .= '"Date":"'   . $rs["Date"]        . '",';
       $outp .= '"Descrip":"'   . $rs["Descrip"]        . '",';
       $outp .= '"Image":"'. $rs["Image"]     . '"}';
      }
  $outp .="]";
  $conn->close();
  echo($outp);
  ?>
 
     
     
    