I have a plugin with multiple options, on frontend I'm using an angular app which will show all these options, so I need to save it in the DB as a JSON.
I have around 10 options, and I want all 10 to be saved in only 1 row in wp_options
in a JSON format, currently update_option("fee", $_POST[$key]);
saves only the last option.
if(array_key_exists('submit_settings', $_POST))
{
foreach($global_settings->globals[0] as $key => $value)
{
update_option("fee", $_POST[$key]);
}
?>
<div id="setting-error-settings-update" class="updated settings_error notice is-dismissible"> <stron> Settings have been saved. </strong> </div>
<?php
}
foreach($global_settings->globals[0] as $key => $value)
{
echo '<label for='.$key.'>' . $key . '</label>';
echo '<input name='.$key.' value='.$value.' /> <br />';
}