Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9174087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:41:47+00:00 2026-06-17T16:41:47+00:00

This is my code for the radio buttons. I would like them to be

  • 0

This is my code for the radio buttons. I would like them to be displayed in the settings page and save it for future use.

<form method="post" action="options.php">  
<?php 
    wp_nonce_field('update-options'); 
    $rsp_position = get_option('rsp_position');
    if(empty($rsp_position)){
        $rsp_position = "true";
    } else {
        $rsp_position = get_option('rsp_position');
    }
?>  
<p><strong>Ad Placing:</strong><br />

<input type="radio" id="1" name="rsp_position" <?php if($rsp_position == 'true') echo 'checked="checked"'; ?> value="true" />yes <br />
<input type="radio" id="2" name="rsp_position" <?php if($rsp_position == 'false') echo 'checked="checked"'; ?> value="flase" />no <br />

<input type="text" name="publisher-id" size="45" value="<?php echo get_option('publisher-id'); ?>" />  
</p>  
<p><input type="submit" name="Submit" value="Save" /></p>  
<input type="hidden" name="action" value="update" />  
<input type="hidden" name="page_options" value="publisher-id" /> 
<?php 
    settings_fields( 'save_position' ); 
    register_setting( 'save_position', 'rsp_position');
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:41:49+00:00Added an answer on June 17, 2026 at 4:41 pm

    You’re going along the right lines, but your calls to settings_fields and register_setting aren’t in the right place.

    Read Otto’s tutorial on this, it’s a good introduction to the settings API.

    Basically, add an admin_init action and in the callback register the setting and use add_settings_field to create the form items.

    Then in your add_options_page callback you make the call to settings_fields to display the entries created with add_settings_field.

    If you’re still struggling having worked through Otto’s tutorial, post back again.

    EDIT: Following pastebin entry.

    The failure to save is a result of your validation function not returning the expected value. The preg_match is not finding the right value and turning the string to ” (nothing) before saving – so it looks like it’s not saving, when in fact it’s saving nothing.

    You could also check out the following functions which may be useful.

    • submit_button

    • settings_errors

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using this code to sum values from multiple radio buttons : $(document).ready(function(){
I have a set of radio buttons, and would like to make both the
I have the following jQuery code to make my checkboxes act like radio buttons,
Using jQuery UI I have two radio buttons, Approve/Reject, which I would like to
I have four radio buttons and I would like to get the drop-down menu
I would like to automatically select the first radio button of multiple radio buttons
I'm creating a form and have a set of radio buttons displayed horizontally using
Hi I have been working on this code that creates a table with radio
1. Problem I am adding a shoutcast radio to website (appeding this code to
I have this HTML code for radios: <input type='radio' name='a_27' value='Yes' id='a_27_0' /> <input

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.