WordPress.org

Ready to get started?Download WordPress

Forums

How to save the values of checkbox to the register setting of wordpress? (1 post)

  1. vicky081
    Member
    Posted 1 year ago #

    <?php
    function default_menu() {
    <form action="options.php" method="post">
     <?php settings_fields( 'sample_check' );?>
    <input type="checkbox" name="sample" value="nofollow"/>
    </form>
    
    function reg_setting() {
    register_setting('sample_check','???');
    }

    Hi all, I struggle for the day to store the check box values to the register setting . For the text box i used directly like

    <input type="text" name="sam" value="<?php get_option('samip');?>" />

    Also I register the values to the register setting like

    register_setting('sample_check','samip');

    But i don't know how to do this for checkbox anyone give me a suggestion to do this is great.

    Thanks, vicky

Topic Closed

This topic has been closed to new replies.

About this Topic