Possible Duplicate:
json_encode is returning NULL?
I'm having a strange problem with json_encode()
in php. Pretty simple code:
$content = json_encode(array('content1' => $arm_length,
'content2' => $body_length));
echo $content;
$arm_length
and $body_length
variables contain the HTML markup for two select dropdown menus. My problem is when it echo
's out it show's NULL
for content1
and content2
. If I take the json_encode()
away and just do print_r($content)
it shows all the data as it should be.
Does anyone know what's happening here? Is there certain data that can't be parsed into JSON? I've done this a few times now using Ajax/PHP and never had any problems.
Cheers for any help with this.