Problems inserting data to mysql - New to Ionic -?

Hello I am trying to isnert some data into a MYSQL table , it some what works, when i click submit it creates a new entry in the table but none of the information is being sent to the php file.

Here is what I have
app.js

var app = angular.module('starter', ['ionic']);

app.run(function ($ionicPlatform) {
    $ionicPlatform.ready(function () {
        // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
        // for form inputs)
        if (window.cordova && window.cordova.plugins.Keyboard) {
            cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
        }
        if (window.StatusBar) {
            StatusBar.styleDefault();
        }
    });
});

app.controller('customersCtrl', function ($scope, $http) {

    $http.get("http://mrbproduktions.com/app/query.php")
	.success(function (response) { $scope.names = response.records; });
});

app.controller('newInvoice', function ($scope, $http) {

    $scope.addNewInvoice = function (add) {
    var data = {
        firstname:$scope.newInvoice.firstname,
        lastname:$scope.newInvoice.lastname
    }
    $http.post("http://mrbproduktions.com/app/insert.php", { 'firstname': $scope.newInvoice.firstname, 'lastname': $scope.newInvoice.lastname })
        .success(function (data, status, headers, config) {
            console.log($scope.newInvoice.firstname);
        });
};   
});

insert.php

<?php 



$mysql_host = "localhost";

$mysql_database = "DB";

$mysql_user = "user";

$mysql_password = "pass";

// Create connection

$conn = new mysqli($mysql_host, $mysql_user, $mysql_password,$mysql_database);





if ($conn->connect_error) {

    die("Connection failed: " . $conn->connect_error);

} 





	$data = json_decode(file_get_contents("php://input"));

$fstname = mysql_real_escape_string($data->firstname);

$lstname = mysql_real_escape_string($data->lastname);

	

$sql = "INSERT INTO invoices (customer_first,customer_last) VALUES ('$fstname','$lstname')";

$result = $conn->query($sql);

echo($fstname);
error_log($fstname);

$conn->close();



?>

index.html

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    <title></title>

    <link href="lib/ionic/css/ionic.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">

    <!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
    <link href="css/ionic.app.css" rel="stylesheet">
    -->
    <!-- ionic/angularjs js -->
    <script src="lib/ionic/js/ionic.bundle.js"></script>

    <!-- cordova script (this will be a 404 during development) -->
    <script src="cordova.js"></script>

    <!-- your app's js -->
    <script src="js/app.js"></script>
</head>
<body ng-app="starter">

    <ion-pane>
        <ion-header-bar class="bar-stable">
            <h1 class="title">Test</h1>
        </ion-header-bar>
        <ion-content>
            <div ng-controller="customersCtrl">

                <ul>
                    <li ng-repeat="x in names">
                        {{ x.Username }}
                        {{ x.Password }}
                    </li>
                </ul>

            </div>
            <div ng-controller="newInvoice">
                <form name="addinvoice" method="post">
                    First Name:<input type="text" ng-model="newInvoice.firstname" name="firstname"/>
                    Last Name:<input type="text" ng-model="newInvoice.lastname" name="lastname"/>
                    <button data-ng-click="addNewInvoice()" name="add">Add Friend</button>
                </form>
            </div>

        </ion-content>
    </ion-pane>
</body>
</html>

Test you http://mrbproduktions.com/app/query.php with Rest Client like PostMan to ensure php saving data into database .

Then test from ionic.

Send data to query.php

Ok with using postman I was able to get information INTO my database. so once I knew my insert.php was working correctly with using postman. But I believe my solution to my error came when adding this header to my php file

header(‘Access-Control-Allow-Origin: *’);

I belive this is the CORS header, not postive but it worked for me.