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.

Sorry for the question but can you help me? I have this form in a widget:

<form> 
 <fieldset>
  <legend>Counter Position:</legend>
  </br>
  <p> 
   Right  <input type="radio" name="position" value="right"/>
  <p>  
   Left  <input type="radio" name="position" value="left"/>
  <p>
   Center  <input type="radio" name="position" value="center"/>
</fieldset>
</form>

how to save on database the option selected?

share|improve this question
    
is this a form for the widget admin page - or front-end? –  Stephen Harris Apr 27 '12 at 12:23

1 Answer 1

up vote 0 down vote accepted
<?php add_option( $option, $value, $deprecated, $autoload ); ?>

http://codex.wordpress.org/Function_Reference/add_option

global $options;
    ?>
    <form action="options.php" method="post">
    <?php $settings = get_option( 'options' ); 
    ?>
    <?php settings_fields( 'theme_options' ); ?>
 <fieldset>
  <legend>Counter Position:</legend>
  </br>
  <p> 
   Right  <input type="radio" name="position" value="right"/>
  <p>  
   Left  <input type="radio" name="position" value="left"/>
  <p>
   Center  <input type="radio" name="position" value="center"/>
</fieldset>
</form>

    <?php 


function r_set(){
    register_setting( 'theme_options', 'options', 'validate_options' );
}
add_action('admin_init','r_set');
function validate_options($value){
global $sa_options;
$val['position'] = $value['position'];
    return $val;
}
share|improve this answer
    
thanks, how to use for save the radio selected from users?? –  victor Apr 27 '12 at 11:51
    
check my edit.. –  Mohit Bumb Apr 27 '12 at 11:57

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.