0

Form:

<!-- Form used for updation of data into database -->
<form class="form-horizontal alert alert-warning" id="editForm" ng-submit="ProcessClient(currentUser)" hidden style="margin-top: 3%;">
<h3 class="text-center">Client preluat</h3>
    <div class="form-group">
        <label for="Name">Nume client:</label>
        <input type="text" class="form-control" ng-model="currentUser.nume_client" value="{{currentUser.nume_client}}">
    </div>

    <div class="form-group">
    <label for="Motive">Motivul prezentării la recepție:</label>
    <select class="form-control" name="motive">
        <option>Ridicare produs</option>
        <option>Predare produs</option>
        <option>Factura storno</option>
        <option>Reclamatie</option>
        <option>Informare</option>
    </select>
    </div>

    <div class="form-group">
        <label for="Email">Fișă service:</label>
        <input type="text" class="form-control" />
    </div>

    <div class="form-group">
        <label for="fise_cu_probleme" style="float: left; margin-left: 2%;">Observație:</label>
        <input type="checkbox" name="fise_cu_probleme" class="checkbox" value="DA" id="checkbox" ng-model="currentUser.fise_cu_probleme" />
    </div>

    <div class="form-group" id="observatii" style="display: none;">
        <label for="observatii">Observații:</label>
        <textarea class="form-control" name="observatii" value=""></textarea>
    </div>

    <div class="form-group">
        <button class="btn btn-warning" ng-disabled="empList.$invalid" ng-click="updateMsg(currentUser.id)">Client soluționat</button>
    </div>
</form>

AngularJS:

$scope.ProcessClient = function(info){

$http.post('includes/assets/receptie_clienti/databaseFiles/processing_client.php',{"id":info.id,"name":info.nume_client,"gender":info.motiv,"email":info.fisa_service,"observatii":info.observatii,"fise_cu_probleme":info.fise_cu_probleme}).success(function(data){
$scope.show_form = true;
if (data == true) {
getInfo();
}
});
}

And php code where query executes:

<?php session_start();
// Including database connections
require_once 'database_connections.php';
// Fetching the updated data & storin in new variables
$data = json_decode(file_get_contents("php://input")); 
// Escaping special characters from updated data
$id = mysqli_real_escape_string($connection, $data->id);
$name = mysqli_real_escape_string($connection, $data->name);
$email = mysqli_real_escape_string($connection, $data->email);
$gender = mysqli_real_escape_string($connection, $data->gender);
$fise_cu_probleme = mysqli_real_escape_string($connection, $data->fise_cu_probleme);
$observatii = mysqli_real_escape_string($connection, $data->observatii);
$date = date_create('');
$ora_rezolvare = date_format($date, 'H:i');
$client_rezolvat = 'REZOLVAT';
$operator = $_SESSION['username'];
// mysqli query to insert the updated data
mysqli_begin_transaction($connection);
$query = mysqli_query($connection,"UPDATE flux_zilnic SET motiv='$gender',nume_client='$name',status_rezolvare='$client_rezolvat',ora_rezolvare='$ora_rezolvare',fisa_service='$email',fise_cu_probleme='$fise_cu_probleme',observatii='$observatii' WHERE id='$id'") or die("NU AM ACTUALIZAT FLUXUL ZILNIC DEOARECE: <br>".mysqli_error($connection));
$queryTwo = mysqli_query($connection,"UPDATE birouri SET disponibilitate = 'LIBER' WHERE username = '$operator'") or die("NU AM ACTUALIZAT DISPONIBILITATEA DEOARECE: <br>".mysqli_error($connection));
mysqli_commit($connection);
?>

It returnes me error:

PHP Notice: Undefined property: stdClass::$fise_cu_probleme in C:\wamp64\www\includes\assets\receptie_clienti\databaseFiles\processing_client.php

PHP Notice: Undefined property: stdClass::$observatii in C:\wamp64\www\includes\assets\receptie_clienti\databaseFiles\processing_client.php

What can it be the problem?

Bogdan C
  • 393
  • 1
  • 3
  • 15
  • [What is stdClass in PHP?](http://stackoverflow.com/questions/931407/what-is-stdclass-in-php?rq=1) – Mistalis Mar 22 '17 at 16:06
  • It means that `fise_cu_probleme` and `observatii` are undefined. Find the place where the other four (`id`, `name`, `email` and `gender`) are defined and fix it from there. – Félix Gagnon-Grenier Mar 23 '17 at 04:05
  • I tried that but no luck. I addeed them there and still same error. Curious thing about `json_decode(file_get_contents("php://input"));` – Bogdan C Mar 24 '17 at 11:26

0 Answers0