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

  • SEARCH
  • Home
  • 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 8104523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:52:28+00:00 2026-06-05T23:52:28+00:00

Problem: Determine which radio button was sent based on their order and submit the

  • 0

Problem:

Determine which radio button was sent based on their order and submit the value with PHP.

HTML table 1 code:

<table class="table table-bordered neutralize" id="itembuttons">
    <thead>
        <tr>
            <th><input type="radio" name="3" id="3" value="6"></th>
            <th><input type="radio" name="3" id="3" value="7"></th>
            <th><input type="radio" name="3" id="3" value="8"></th>
            <th><input type="radio" name="3" id="3" value="9"></th>
            <th><input type="radio" name="3" id="3" value="10"></th>
        </tr>
    </thead>
</table>

HTML table 2 code:

<table class="table table-bordered neutralize" id="itembuttons">
    <thead>
        <tr>
            <th><input type="radio" name="3" id="3" value="11"></th>
            <th><input type="radio" name="3" id="3" value="12"></th>
            <th><input type="radio" name="3" id="3" value="13"></th>
        </tr>
    </thead>
</table>

Scenario:

The above code will generate a POST variable in PHP called “3” that will have a value between 6 and 10 in Table 1 or 11 and 13 in Table 2. However, I would like jQuery to determine which button was actually chosen. So for instance, if I choose 3rd button (value=8 or value=13)) then the value 3 should be sent in a hidden input field. If the 5th button was chosen (value=10) then the value 5 should be sent in a hidden input field.

  • 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-05T23:52:29+00:00Added an answer on June 5, 2026 at 11:52 pm

    Try this – http://jsfiddle.net/Xa42c/

    $("input[type=radio]").on("click", function(e) {
        $("input[type=hidden]").val( $(this).val() );
    
        alert( "Hidden field value is set to " + $(this).val() );
    });​
    

    Note that you don’t need the id-s. But if you want to use them they must be unique

    UPDATE To get position use index() – http://jsfiddle.net/Xa42c/2/

    $("input[type=radio]").on("click", function(e) {
        var index = $("input[type=radio]").index(this) + 1;
        $("input[type=hidden]").val( index );
    
        alert( "Hidden field value is set to " + index );
    });​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Often i have a problem that I need to determine which assebmly to include
I'm trying to determine the best way of having a PHP script determine which
I am using the following code to determine which key is pressed by the
Another RegEx question for a search I'm trying to do. The Problem : Determine
I love challenges like this, I'll hopefully submit my answer soon. Which player has
I saw this question , which focuses on the Brittney Spears problem. But I
I've been using Eclipse ${project_name} variable as a configuration class hack to determine which
I need to be able to determine which database to use at login time
Is there a way to determine which classes are loaded from which JARs at
Using C# I want to determine which DC (or at least which Site) the

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.