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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:09:03+00:00 2026-05-25T10:09:03+00:00

I have a form with several radio buttons grouped by the same name, and

  • 0

I have a form with several radio buttons grouped by the same name, and those radio buttons are generated dinamically, there are 20 in total, but it will only be submitted 4 each time. Each radio button group as an ID as name of the group. When post the form to PHP (using jQuery Serialize) I get something like this:

1=3&2=6&4=9&7=2

I need to get the values of each parameter, in this case 1, 2, 4 and 7 and also to know which was the fields submitted (in this case the field 1, 2, 4 and 7 was submitted)

I did something like this, but not working:

for ($c = 1; $c <= 20; $c++){

if (isset($_GET[$c])){
    $question_id = $c;
    $answer_score = $_GET[$c];
    echo $answer_score;

    $gravar = "INSERT INTO iMood_ColabsQuestionAnswers (colab_id, answer_id, score) VALUES (?, ?, ?)";
    /* Set parameter values. */
    $valores = array($user, $question_id, $answer_score);

    echo $valores.'<br />';
    /* Prepare and execute the query. */
    $inserirResposta = sqlsrv_query( $conn, $gravar, $valores);
    sqlsrv_free_stmt($inserirRespota);
    sqlsrv_close($conn);
}
}

Can’t find a solution for this, because the above solution, doesn’t see any record and if use

$_GET['$c'];

It returns an error in SQL query, saying that found an unexpected (.

  • 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-05-25T10:09:04+00:00Added an answer on May 25, 2026 at 10:09 am

    How are you submitting that serialized string from jquery?

    Doing something like

    $.ajax(function() {
       data: '1=3&2=6&4=9&7=2'
       ...
    });
    

    would lead to the problem you’re having. This would submit a complete string containing those “query” variables, but do it without an associated field name, so PHP will NOT pick up the fact that this string contains individual key/value pairs.

    However, using

      data: { data: '1=3&2=6&4=9&7=2' }
    

    will let things work in PHP properly, and you’d get at the data like this:

    $query = parse_str($_GET['data']);
    
    foreach($query as $question_id => $answer_score) {
       ... do database stuff ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several radio buttons with the same name. Like this: <form name=formA> <input
I have several radio buttons on a form all grouped in 3's, and when
I have several radio buttons that are dynamically populated on a form and I
Several radio buttons with the same name act as a set, where checking one
I have a form that is dynamically created, on this form are several radio
I have a form in which several buttons are added at runtime via a
I have a frame with several radio buttons where the user is supposed to
I have a form with several fields that will be a fairly active. With
I have a win form, on which there are several radionbuttons and labels and
I have the following HTML: <form id=test> <input type=radio value=A name=C1/> <a href=javascript:selectCheckbox('C1', 'A');>

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.