if (isset($_POST["save-options"])) {
foreach ($names_of_array as $type => $value) {
update_option('updated_img', $_POST['show_img_url']);
if (isset($_POST["post0"])) {
update_option($names_of_array[0], true);
} else {
update_option($names_of_array[0], false);
}
if (isset($_POST["post1"])) {
update_option($names_of_array[1], true);
} else {
update_option($names_of_array[1], false);
}
if (isset($_POST["post2"])) {
update_option($names_of_array[2], true);
} else {
update_option($names_of_array[2], false);
}
if (isset($_POST["post3"])) {
update_option($names_of_array[3], true);
} else {
update_option($names_of_array[3], false);
}
if (isset($_POST["post4"])) {
update_option($names_of_array[4], true);
} else {
update_option($names_of_array[4], false);
}
}
}
HTML table is in form>>>>
<tr>
<td class="td-sample-settings"><input name="post0" value="<?php echo $names_of_array; ?>" type="checkbox" <?php echo (get_option("show_price") == true ? 'checked' : ''); ?> ></td>
<td class="td-sample-settings"><input name="post1" value="<?php echo $names_of_array; ?>" type="checkbox" <?php echo (get_option("show_width") == true ? 'checked' : ''); ?> ></td>
<td class="td-sample-settings"><input name="post2" value="<?php echo $names_of_array; ?>" type="checkbox" <?php echo (get_option("show_height") == true ? 'checked' : ''); ?> ></td>
<td class="td-sample-settings"><input name="post3" value="<?php echo $names_of_array; ?>" type="checkbox" <?php echo (get_option("show_weight") == true ? 'checked' : ''); ?> ></td>
<td class="td-sample-settings"><input name="post4" value="<?php echo $names_of_array; ?>" type="checkbox" <?php echo (get_option("show_color") == true ? 'checked' : ''); ?> ></td>
<td class="td-sample-settings"><input name="updated_img" type="button" id="insert-my-media" class="media-button button" value="Add my media"> </td>
<td class="td-sample-settings"><input name="show_img_url" type="text" class="next-button" id="set_imaged_id" value="<?php echo $_POST['show_img_url']; ?>" > </td>
</tr>