Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $postdata = file_get_contents("php://input");
- $request = json_decode($postdata);
- $servername = "localhost";
- $username = "root";
- $password = "";
- $dbname = "test";
- $conn = new mysqli($servername, $username, $password, $dbname);
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }else{
- foreach ($request as $key => $jsons) {
- foreach($jsons as $key => $value) {
- $equip = $value['equipment'];
- $sql = "INSERT INTO contratos (equipo) VALUES ('$equip')";
- }
- }
- $scope.continue = function(choices)
- {
- var data = $scope.choices;
- $http.post('php/phptest.php', data)
- .then(function(response) {
- console.log(response);
- });
- };
- [
- {
- "id":"choice1",
- "quantity":1,
- "equipment":"BLONG - F25",
- "teamvox":true,
- "plandatos":"D50"
- },
- {
- "id":"choice2",
- "quantity":1,
- "equipment":"OUTERFONE - S17",
- "evidence":true,
- "mobictrl":true,
- "plandatos":"D100"
- }
- ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement