Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/252.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
爱奥尼亚手风琴列表+;角度JS+;PHP表单帖子_Php_Angularjs_Json_Ionic Framework_Accordion - Fatal编程技术网

爱奥尼亚手风琴列表+;角度JS+;PHP表单帖子

爱奥尼亚手风琴列表+;角度JS+;PHP表单帖子,php,angularjs,json,ionic-framework,accordion,Php,Angularjs,Json,Ionic Framework,Accordion,我使用的是爱奥尼亚手风琴列表,所以表单输入被空发送到数据库。当我不使用'ng repeat=“groups in groups”时,我可以将数据保存到数据库中。我非常确定insert.php中没有任何问题。我希望有人能帮我把数据发送到mysql,而不是空数据。问题在于组数组,在控制器中它无法识别输入值 <ion-content ng-controller="CheckOutCtrl"> <form>

我使用的是爱奥尼亚手风琴列表,所以表单输入被空发送到数据库。当我不使用'ng repeat=“groups in groups”时,我可以将数据保存到数据库中。我非常确定insert.php中没有任何问题。我希望有人能帮我把数据发送到mysql,而不是空数据。问题在于组数组,在控制器中它无法识别输入值

    <ion-content ng-controller="CheckOutCtrl">
                <form>
                        <ion-list>
                            <!--Step 1 Billing Details-->        
                            <div ng-repeat="group in groups">
                                <ion-item class="item-stable checkout item ng-binding active" ng-click="toggleGroup(group)" ng-class="{active: isGroupShown(group)}">
                                    <i class="icon" ng-class="isGroupShown(group) ? 'ion-minus' : 'ion-plus'"></i>
                                    &nbsp; 
                                    {{group.name}}
                                </ion-item>
                                <ion-item class="item-accordion" ng-repeat="item in group.items" ng-show="isGroupShown(group)">
                                    <input ng-required="true" ng-model="firstname" class="dumbie" type="text" placeholder="{{item.subName}}">
                                    <span class="error" ng-show="myForm.first_name.$error.required">First name is required!</span>

                                    <input ng-required="true" ng-model="lastname" class="dumbie" type="text" placeholder="{{item.subLName}}">
                                    <div role="alert"> <span class="error" ng-show="myForm.last_name.$error.required"> Last name is required!</span> </div>
                                    <input ng-required="true" ng-model="email" class="dumbie" type="text" placeholder=" {{item.subEmail}}">
                                    <div role="alert"> <span class="error" ng-show="myForm.email.$error.required"> Email is required!</span>  </div>

                                    <input class="dumbie" ng-model="telephone" type="text" placeholder=" {{item.subTelephone}}">

                                </ion-item>
                            </div>
        </ion-list>
        </form>
        </ion-content>

Controller->

.controller('CheckOutCtrl', function ($scope, $http) {
           $scope.insertdata=function(){
                        var link = 'http://edu.local/fb_store/www/templates/insert.php';
                        $http.post(link,{"firstname":$scope.firstname,"lastname":$scope.lastname,"email":$scope.email,"telephone":$scope.telephone})
                                .success(function(data,status,headers,config){
                                    console.log("Data inserted successfully");
                        });
                    };


            $scope.groups = [];


            $scope.groups = [
                {name: 'Step 1: Billing Details', id: 1, items: [{subName: 'First Name', subLName: 'Last Name', subEmail: 'Email', subTelephone: 'Telephone', subFax: 'Fax', subCompany: 'Company', subAddress1: 'Address 1', subAddress2: 'Address 2', subCity: 'City', subPostal: 'Postal Code', subCountry: 'Sri Lanka', subRegion: 'Northern Province', subId: '1-1'}]}
                // { name: 'Step 5: Confirm Order', id: 1, items: [{ subName: 'SubGrup1', subId: '1-1' }, { subName: 'SubGrup1', subId: '1-2' }]},
            ];

            $scope.toggleGroup = function (group) {
                if ($scope.isGroupShown(group)) {
                    $scope.shownGroup = null;
                } else {
                    $scope.shownGroup = group;
                }
            };
            $scope.isGroupShown = function (group) {
                return $scope.shownGroup === group;
            };

        });

{{group.name}
名字是必需的!
姓是必需的!
电子邮件是必需的!
控制器->
.controller('CheckOutCtrl',函数($scope,$http){
$scope.insertdata=function(){
var-link=http://edu.local/fb_store/www/templates/insert.php';
$http.post(链接,{“firstname”:$scope.firstname,“lastname”:$scope.lastname,“email”:$scope.email,“telephone”:$scope.telephone})
.success(函数(数据、状态、标题、配置){
console.log(“数据插入成功”);
});
};
$scope.groups=[];
$scope.groups=[
{name:'Step 1:Billing Details',id:1,items:[{subName:'First name',subName:'Last name',subEmail:'Email',subTelephone:'Telephone',subtax:'Fax',subCompany:'Company',subaddress 1:'Address 1',subaddress 2:'Address 2',subCity:'City',substal:'Postal Code',subCountry:'srianka',subCity:'s:'slianka',subsection
//{name:'Step 5:Confirm Order',id:1,items:[{subName:'SubGrup1',subId:'1-1'},{subName:'SubGrup1',subId:'1-2'}]},
];
$scope.toggleGroup=函数(组){
如果($scope.isgroupshow(组)){
$scope.shownGroup=null;
}否则{
$scope.shownGroup=组;
}
};
$scope.isGroupShowed=函数(组){
返回$scope.shownGroup==group;
};
});

尝试使用对象包装所有ng模型内容

<ion-item>
    <input ng-required="true" ng-model="object.firstname" class="dumbie" type="text" placeholder="{{item.subName}}">
    <input ng-required="true" ng-model="object.lastname" class="dumbie" type="text" placeholder="{{item.subLName}}">
    <input ng-required="true" ng-model="object.email" class="dumbie" type="text" placeholder=" {{item.subEmail}}">
    <input class="dumbie" ng-model="object.telephone" type="text" placeholder=" {{item.subTelephone}}">
</ion-item>

app.controller('CheckOutCtrl', function ($scope, $http) {
    $scope.object={};
    $scope.insertdata=function(){
         var link = 'http://edu.local/fb_store/www/templates/insert.php';
         $http.post(link,$scope.object)
           .success(function(){
                 console.log("Data inserted successfully");
         })                                          
      });
    };
});

app.controller('CheckOutCtrl',函数($scope,$http){
$scope.object={};
$scope.insertdata=function(){
var-link=http://edu.local/fb_store/www/templates/insert.php';
$http.post(链接,$scope.object)
.success(函数(){
console.log(“数据插入成功”);
})                                          
});
};
});