i have this variable $a
var_dump($a)
array(3) { [0]=> string(10) "designer" [1]=> string(8) "director" [2]=> string(10) "Freelancer"}
i am sending this in ajax(jquery)
jquery
data: 'form=<?php echo json_encode($a); ?>',
and in the other php file i am doing
$send = $_POST[form];
$b = json_encode($send);
$c = json_decode($b, true);
var_dump($c);
the output will be:
string(xx) "[\"designer\",\"director\",\"Freelancer\"]"
but, echo $c[0] show this: [ and should be "designer"
Any help ?
EDIT: already tried too
$send = $_POST['form'];
$c = json_decode($send, true);
var_dump($c);
output: `null`
$_POST[form]is probably incorrect, unless you are using a constant namedform.$a = array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5); ?>there is no problem.