Undefined Index Error

2 posts, 0 answers
  1. Benedict
    Benedict avatar
    6 posts
    Member since:
    Jul 2013

    Posted 24 Jul 2013 Link to this post

    i always get this undefined index error whenever i try to insert, update or delete from a grid....using php via json...please can someone help out. and how do i name my form element in the grid? thanks 
    code below:

    if ($verb == "PUT") {

        // DISCLAIMER: It is better to use PHP prepared statements to communicate with the database.
        //             this provides better protection against SQL injection.
        //             [http://php.net/manual/en/pdo.prepared-statements.php][4]

        // get the parameters from the get. escape them to protect against sql injection.

        $employeeId = mysql_real_escape_string($_POST["EmpId"]);
        $firstName = mysql_real_escape_string($_POST["Fname"]);

        $rs = mysql_query("INSERT INTO users (EmpId,Fname) VALUES ('" .$employeeId. "','" .$firstName ."')");

        if ($rs) {
            echo json_encode($rs);
        else {
            header("HTTP/1.1 500 Internal Server Error");
            echo "Insert Failed";

                    $(document).ready(function () {
                          dataSource = new kendo.data.DataSource({
                                transport: {
                                    read:  {
                                        url: "data/users.php",
                                        dataType: "json",
                                    update: {
                                        url: "data/users.php",
                                        dataType: "json",
                                    create: {
                                        url: "data/users.php",
                                        dataType: "json",
                                      destroy: {
                                        url: "data/users.php",
                                        dataType: "json",
                                        type: "DELETE"

                                 error: function(e) {
                                schema: {
                                model: {

                                    fields:{ Fname: { validation: { required: true} }

                             pageSize: 10

                            dataSource: dataSource,
                            height: 430,
                            pageable: true,
                            toolbar: ["create"],
                            columns: [{field: 'EmpId', title: 'EmployeeID'},
                                     {field: 'Fname', title: 'FirstName'},
                                     { command: ["edit", "destroy"], title: "&nbsp;", width: "160px" }],
  2. Petur Subev
    Petur Subev avatar
    1882 posts

    Posted 26 Jul 2013 Link to this post

    Hello Benedict,

    We are not sure what exactly is causing this. Did you check the net for similar problem related to PHP ?


    If possible provide a sample page that we can run to reproduce the problem.

    Kind Regards,
    Petur Subev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top