Nikita Dhiman Nikita Dhiman - 4 years ago 137
JSON Question

codeigniter form response as json

In my codeigniter application I have a form in my views and I want to pass the responses received from this form in json format for further use. Can anyone guide me on steps to do the same please

Answer Source

This code might help

 $arr=['name'=>'Ankita','education'=>'Graduate'];

 $json=json_encode($arr);

 var_dump($json);

The result would be

string(40) "{"name":"Ankita","education":"Graduate"}"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download