I currently have JSON data which looks like below
[
{
"company": "East Lifestyle Limited",
"phone1": "020 8877 5900",
"website": "http://www.east.co.uk"
},
{
"company": "Wandsworth Security",
"phone1": "020 8870 9745",
"website": ""
}]
in my php I have
$jsondata = $this->input->post('leads');
$data = json_decode($jsondata, true);
$id = $data['company'];
echo "$id";
When trying to show the company, i am getting the following error :
A PHP Error was encounteredSeverity: Notice
Message: Undefined index: company
Filename: controllers/leads.php
Line Number: 334
Also just out of curiosity, and sorry if this makes it a 2 part question - When doing the echo $id;
will this only do echo the first company in the list or will it echo them all?
I'd like it to echo them all when it works.
Thanks