Handling a WordPress form with multiple checkboxes if (isset($_POST["save-options"])) {



    foreach ($names_of_array as $type =&gt; $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>>>> 

&lt;tr&gt;

                &lt;td class="td-sample-settings"&gt;&lt;input name="post0"  value="&lt;?php echo $names_of_array; ?&gt;"  type="checkbox" &lt;?php echo (get_option("show_price") == true ? 'checked' : ''); ?&gt;   &gt;&lt;/td&gt;      
                &lt;td class="td-sample-settings"&gt;&lt;input name="post1" value="&lt;?php echo $names_of_array; ?&gt;"  type="checkbox" &lt;?php echo (get_option("show_width") == true ? 'checked' : ''); ?&gt; &gt;&lt;/td&gt;
                &lt;td class="td-sample-settings"&gt;&lt;input name="post2" value="&lt;?php echo $names_of_array; ?&gt;"  type="checkbox" &lt;?php echo (get_option("show_height") == true ? 'checked' : ''); ?&gt; &gt;&lt;/td&gt;
                &lt;td class="td-sample-settings"&gt;&lt;input name="post3" value="&lt;?php echo $names_of_array; ?&gt;"  type="checkbox" &lt;?php echo (get_option("show_weight") == true ? 'checked' : ''); ?&gt; &gt;&lt;/td&gt;   
                &lt;td class="td-sample-settings"&gt;&lt;input name="post4" value="&lt;?php echo $names_of_array; ?&gt;"  type="checkbox" &lt;?php echo (get_option("show_color") == true ? 'checked' : ''); ?&gt; &gt;&lt;/td&gt;
                &lt;td class="td-sample-settings"&gt;&lt;input name="updated_img"  type="button" id="insert-my-media" class="media-button button"  value="Add my media"&gt;  &lt;/td&gt;
                &lt;td class="td-sample-settings"&gt;&lt;input name="show_img_url" type="text" class="next-button" id="set_imaged_id" value="&lt;?php echo $_POST['show_img_url']; ?&gt;" &gt;   &lt;/td&gt;   

            &lt;/tr&gt;
You are open to reflected XSS via show_img_url. You should always HTML encode user input when outputting it.
You don't really need to add the class to each cell. Just add it to the table to avoid duplication and increase readability.
Your spacing and indentation is slightly off (the tr elements don't align, and the first td element has too many spaces)