Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.
<?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 have struggled all day to store the check box values to the register setting. For the text box I used:

<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 a checkbox. If anyone could give me a suggestion for how to do this, that would be great.

Thanks, vicky

share|improve this question

1 Answer 1

why not simply put checkbox value it in an option instead :

<?php update_option( $option, $new_value ); ?> 

http://codex.wordpress.org/Function_Reference/update_option
http://codex.wordpress.org/Function_Reference/get_option

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.