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 8489271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:47:00+00:00 2026-06-10T21:47:00+00:00

I am unable to get the selected radio button value in a form post.

  • 0

I am unable to get the selected radio button value in a form post. No matter which option I select, I am getting the value “on”. Note this is in a WordPress Plugin Options page.

Code for form below:

?>
<div class="wrap">
    <?php screen_icon(); ?>
    <h2>Title</h2>
    <br />
    <form action="options-general.php?page=page" method="post">
    <table class="widefat">
    <thead>
        <tr>
            <th></th>
            <th>Site Name</th>
            <th>Site URL</th>
            <th>Username</th>
        </tr>
    </thead>
    <tfoot>
        <tr>
            <th></th>
            <th>Site Name</th>
            <th>Site URL</th>
            <th>Username</th>
        </tr>
    </tfoot>
    <tbody>
    <?php 

    $size = count($sites);

    for ( $i = 0; $i < $size; $i++) {

        echo '<tr>';

        for ($j = 0; $j < 4; $j++) {
            if ($j == 0) {


            echo '<td><input type="radio" id="cta_siteID_'.$i.'" name="cta_siteID",value="'.$i.'"/></td>';

            }
            else
            {

                echo '<td>'.$sites[$i][$j-1].'</td>';
            }
        }
        echo '</tr>';
    } 
    ?>
    </tbody>
   </table>
   <br />

   <input type="hidden" name="formType" value="main" />
   <select name="selectedItem">
        <option value="" selected="true">Select an Option</option>
        <option value="add">Add Site</option>
        <option value="edit">Edit Site</option>
        <option value="delete">Delete Site</option>
   </select>
   <input type="submit" name="Apply" value="Apply" class="button-primary" />
   </form>
</div>

When I do a var_dump($_POST) after selecting an item in the radio group, I get the following:

onarray(4) { [“cta_siteID”]=> string(2) “on” [“formType”]=> string(4) “main” [“selectedItem”]=> string(4) “edit” [“Apply”]=> string(5) “Apply” }

The values are being rendered correctly in the HTML before posting the form, not sure what is going on.

The “on” value shows up no matter which radio option I select, and does not show up at all if none is selected (as I would expect).

  • 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-10T21:47:02+00:00Added an answer on June 10, 2026 at 9:47 pm

    You shouldn’t have a comma inside your input tag:

    name="cta_siteID",value=
    

    This could well be causing your browser to bork the value being passed.

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

Sidebar

Related Questions

I am unable to get the correct title for this, please change the title
I'm unable to get this jquery statement to work on page load but it
Every other aspect of my autocomplete works but I am unable to get this
I am trying to get selected value of dropdownchoice in wicket framework , but
I have a drop down but i am unable to get the value of
why am I unable to get the ID this way: . $row['ID'] . or
I am trying to get selected cell in inner JTable which is present at
I want to get string of checkedListbox selected values like 1,3,4. To achieve this
I need to get the value of selected dropdown and not the text. eg:
I get unable to open database file when executing rc = sqlite3_open(test.db, &db); ??

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.