如何使用angularjs将单选按钮值传递给php页面

时间:2015-08-13 12:18:51

标签: php angularjs html5

我在html中显示单选按钮

angular.module('myApp', ['angularFileUpload'])
.controller('MainCtrl', function($scope, $http, $upload) {

$scope.onFileSelect = function($files) {
    $scope.message = "";
    for (var i = 0; i < $files.length; i++) {
        var file = $files[i];
        console.log(file);
        $scope.upload = $upload.upload({
            url: 'upload.php',
            method: 'POST',
            data: {name: $scope.name,place: $scope.place, dilation: dilation, nct: nct },            
            file: file
        }).success(function(data, status, headers, config) {
            $scope.message = data;                
        }).error(function(data, status) {
            $scope.message = data;
        });
    }
};
});

这是我的角度控制器

$result = array("filename" => $_FILES["file"],"name" => $_POST['name'],"place" => $_POST['place'],"dilation" => $_POST['dilation'],"nct" => $_POST['nct']);
echo json_encode($result);

这是我的php代码(upload.php)

name:qqq,place:eeee,dilation:{\"ng339\":8},nct:{\"ng339\":10}

这是一个小提琴:http://jsfiddle.net/aabyv4kx/ 并得到像这样的回应

angularjs

我是jdbcTemplate.update("INSERT INTO employee(id, name,salary) VALUES(?,?,?)", 10, "ABC", 12333); 的新手,请帮助我对此进行排序。

0 个答案:

没有答案