WordPress.org

Support

Support » How-To and Troubleshooting » How to save the values of checkbox to the register setting of wordpress?

How to save the values of checkbox to the register setting of wordpress?

  • <?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

  • The topic ‘How to save the values of checkbox to the register setting of wordpress?’ is closed to new replies.
Skip to toolbar