Identifying array elements PHP and AJAX

I have managed to get the correct response to my php page which is listing an array.

I believe that I am passing in AJAX a array string which I can print using $_POST. The problem I am having NOW is when I try to loop through the array to identify its contents which I need to make insertions into a database.

<?php 

    if (ISSET($_POST['data'])) 
    { echo "TRUE./n"; 
    }ELSE{ 
    echo "False./n"; 
    } 

    // look at array var_dump($_POST['data']); 

    // identifies an array property or key / name pair 

    var_dump($_POST['data'][1]["ask"]); 

    // foreach loop: to try to identify array elements 

    foreach($data as $user) 
    { echo $user['ask']; } 
?>

I receive a notice undefined variable data. What am I doing incorrectly?.

More info @ Am I building the JavaScript objects correctly for a JSON string array?

What is $data? Is it $_POST['data'] ? If so, should you not be assigning $_POST['data'] to $data?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.