I connect to an API and receive a JSON Data with PHP. After execute:
$countries= curl_exec($ch);
$jd_countries = json_decode($countries, TRUE);
print $countries;
The result of this is:
I would like to use for each to add the country_id and name to option value
So my code will be something like this:
<select name="country" class="form-control" >
<?php foreach($jd_countries as $value){ ?>
<option value="<?php echo $country_id;?>"><?php echo $name;?>
</option>
<?php } ?>
</select>
I receive this:
Notice: Array to string conversion in C:\xampp\htdocs\account\index.php on line 28 Array
Notice: Array to string conversion in C:\xampp\htdocs\account\index.php on line 28 Array
Any suggestions? Thanks in advance.