通过表单获取数组中的数据

时间:2019-06-18 13:35:12

标签: php json ajax

提交表单时我没有在数组中获取数据。

$post['FirstName'] = $_POST['FirstName'];  //not getting value in array from form
$newArray = array(); // initialize new array
$i = 0;
foreach ($post as $key => $value) {
$newArray[$i]['Attribute'] = $key;
$newArray[$i]['Value'] = $value;
$i++;
}

$data_string =  json_encode($newArray);

HERE IS THE IMAGE

AJAX Call

0 个答案:

没有答案