Here is what i am doing, Storing values from a form to array and then storing that array into a file (array.jason).
if (isset($_POST['addEntity'])) {
$values = array_values($_POST);
print_r($values);
unset($values[1]);
var_dump($values);
$file_values = json_decode(file_get_contents('array.json'), true);
array_combine($file_values,$values);
file_put_contents("array.json",json_encode($values),FILE_APPEND);
}
Now, when i try to merge array from file ($file_values) to an array which i get from submit ($values) i am getting this error or warning :(
Warning: array_combine() expects parameter 1 to be array, null given in C:\Users\tej\PhpstormProjects\Final Year Project\index.php on line 9
json_decode()failed an return NULL, that's whynull given. Tell us the output of:json_last_error_msg()and show your json data. Your json isn't valid. (btw: assigning the return value ofarray_combine()would be good)