0

I have a problem. Early I use PHP 5.3 in my project and all Ajax post requests works great, but now when I migrate on PHP 7 all this request are not working. How to solve this problem.

    $.post
(
    'http://test.atk/php/get_list.php',
    {
     list_item: list_item
    },
    function(list_data){
        alert(list_data);
        console.log(list_data);
        $("list").html(list_data);
    }
);

It`s return empty. In PHP I have:

<?php 
session_start();
$user_id = $_SESSION['user_id'];

include_once "db.php";

$list_item = $_POST['list_item'];

$user_list = $conn->prepare("SELECT * FROM list WHERE user_id = :user_id AND list_id = :list_id");
$user_list -> bindValue(":user_id" , $user_id);
$user_list -> bindValue("::list_id" , $list_item);
$user_list -> execute() ?>

And error_log and firebug gives me the next message:

Notice: Undefined index: list_item in X:\home\test.atk\www\php\get_list.php on line 6

I think the problem in new PHP 7, may be it has new syntax for ajax variebles? Help me if know how.

T.Abdullaev
  • 89
  • 1
  • 10
  • php your php page code... where the element is – BetaDev Dec 18 '16 at 21:33
  • It does not. There is no difference between PHP 7 and 5 on how they treat things like this. Regardless, you ajax-call is not PHP, it's jQuery - how do you get the list_item variable that you send with the ajax-call? Also, what does the rest of your php-file look like? – junkfoodjunkie Dec 18 '16 at 21:34

0 Answers0