php - json_encode an array posted from a form -
i have array being passed method insert database.
i've tried:
$names = $_post['names']; json_encode($names); echo '<pre>' .print_r($names,1). '</pre>'; exit;
and...
json_encode($names = $_post['names']);
but neither seem work.. note when debugging print json encoded array, showing array , values - no json :( suggests array being passed fine json encoding not working!
cheers
you have use returned string. json_encode
not modify array, arguments passed value.
$names = $_post['names']; $jsonencoded = json_encode($names); echo $jsonencoded;
Comments
Post a Comment