更新sql代码不修改数据

I've a php code for accepting the POSTed values of a form and thereafter to update the database accordingly using the sql UPDATE query.

I've another javascript file associated with this page whose function is to display thank you/sorry messages (along with please wait message in case of any delayed responses).

I'm facing 2 problems:

  1. The update sql query, even though returning as success (success as per the info message), is not actually modifying the data in the database.

  2. When I insert var_dump($_POST); in my code, the program is stuck and the page displays a "Please wait" info. The program is stuck at console.error('Inside if loop!'); portion of my code.

Can you please help me in identifying the error in my code?

Thanks AB

The PHP Code part:

<?php   
    require("database_files/database-connect.php");

    $data = filter_input_array(INPUT_POST, [
                    'id'      => FILTER_DEFAULT,
                    'name'    => FILTER_DEFAULT,
                    'email'   => FILTER_VALIDATE_EMAIL,
                    'mobile'  => FILTER_DEFAULT]);

    // var_dump($_POST);

    $update_sql = "UPDATE tbl_details SET name='".$_POST['name']."', email_id='".$_POST['email']."', mobile_number='".$_POST['mobile']."' WHERE id='".$_POST['id']."'";

    mysql_select_db('db_info');
    $update_val = mysql_query( $update_sql, $conn );

    if($update_val)
    {
        echo json_encode(array('result' => true, 'message' => 'Entered data successfully'));
    }

    else
    {
        die(json_encode(array('result' => false, 'message' => 'Could not enter data: ' . mysql_error())));      
    }

    mysql_close($conn);
?>

The Javascript code:

$(function () 
{
    $('form').submit(function (e) 
    {                   
        e.preventDefault();
        // $('#please_wait').show();
        document.getElementById("thankyou_info").style.display = "none";
        document.getElementById("sorry_info").style.display = "none";

        $('#please_wait_info').show();
        console.error('Below Wait!');               

        if(e.target === document.getElementById("info-form"))
        {
            console.error('Inside if loop!');
            $.ajax(
            {
                type:this.method,
                url:this.action,
                data: $(this).serialize(),
                dataType: 'json',
                timeout: 15000,    
                success: function(response)
                {
                    console.error('Inside success loop!');
                    console.log(response);                          
                    if(response.result == true) 
                    {
                        document.getElementById("thankyou_info").style.display = "inline";
                        document.getElementById("form_link").style.display = "inline";
                        $('#please_wait_info').hide();
                        document.getElementById("info-form").reset();
                    }

                    else 
                    {           
                        document.getElementById("thankyou_info").style.display = "none";
                        document.getElementById("sorry_info").style.display = "inline";
                        document.getElementById("form_link").style.display = "none";
                        alert(response.message);
                        $('#please_wait_info').hide();  
                    }


                }



            });             
        }


    });
});