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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:51:45+00:00 2026-06-14T06:51:45+00:00

I am doing a form that displays the questions and answers in a database

  • 0

I am doing a form that displays the questions and answers in a database and now I need to save the answers marked by the user.

I need a name for each RadioButton or select dropdown. PROBLEM: I combine php and html and i don’t know how to pass the radiobutton’s name or select drop down’s name syntactically correct. The radiobuttons answers name are their ID to show all of them ( RADIO17, Radio18, RADIO19,RADIOX…), now I need to save the specific ID of the radiobutton checked by the user, for example RADIO19. Help please.

        <!--RADIO BUTTON--> 

                <div>
                    <label class="desc"name="question" value=" <?php $row_questionset['QuestionIDFKPK'];?>">
                    <?php echo $row_questionset['QuestionValue']; ?>

                    </label>
                </div>
                    <?php while ($row_Answer=mysql_fetch_array($AnswersValue)){ ?>  
                    <fieldset class="radios">

                        <label class="label_radio">


                        **<input name="RADIO<?= $row_Answer['AnswerIDPK'] ?>" value="  <?= $ValueIDradio=$row_Answer['AnswerIDPK'] ?>" type="radio"  />**
                        <?php echo $row_Answer['AnswerValue']; ?> 
                        </label>


                    <?php }  ?>
                    </fieldset>


        <!--INSERTING ANSWERS-->
                                <?php

                                    $name=$_POST['RADIO1']; 

                                if(isset($_POST['submit'])){



                    ??????? -> $name=$_POST['RADIO$row_Answer['AnswerIDPK']'];  

                                $query_AnswerSelected="SELECT * FROM tblanswer WHERE tblanswer.AnswerIDPK = '".$name."' ";
                                $AnswersValueSelected= mysql_query($query_AnswerSelected);                                                                      
                                $row_AnswersValueSelected=mysql_fetch_array($AnswersValueSelected);
                                $Avalue= $row_AnswersValueSelected['AnswerValue'];
                                $useranswer= "INSERT INTO `nuevaspruebas`.`tbluseranswer` (`UserIDFKPK`, `AnswerIDFKPK`, `QuestionIDFK`, `AnswerValue`) VALUES ('$UserId','$name', '$QuestionID',  '$Avalue')";
                                mysql_query($useranswer);   
                                <?= $nameradio=$row_Answer['AnswerIDPK'] ?>;
                                }
                                    ?>
                                <!--INSERTING ANSWERS-->


            <!--RADIO BUTTON--> 


<?php } ?>
  • 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-14T06:51:47+00:00Added an answer on June 14, 2026 at 6:51 am

    for the answers you will have to pass the question id in the name attrbuite and the value of the answer must be passed in the value attr

    Run this code to get the idea:

    <?php
        if($_POST['submit']){
            #you can loop through answers using
            foreach($_POST['question'] as $quesID => $ansID){
                //action goes here
            }
            #view all the posted data
            echo "<pre>";
            print_r($_POST);
            echo "</pre>";
        }
    ?>
    <?php
        $FirstQuestionID = 1;
        $SecondQuestionID = 2;
    ?>
    <form method=post action=<?=$_SERVER['PHP_SELF'];?> >
        first question
        <br />
        <input type="radio" name="question['<?=$FirstQuestionID;?>']" value='1' />
        <input type="radio" name="question['<?=$FirstQuestionID;?>']" value='2' />
        <input type="radio" name="question['<?=$FirstQuestionID;?>']" value='3' />
        <input type="radio" name="question['<?=$FirstQuestionID;?>']" value='4' />
        <br />
        second question
        <br />
        <input type="radio" name="question['<?=$SecondQuestionID;?>']" value='1' />
        <input type="radio" name="question['<?=$SecondQuestionID;?>']" value='2' />
        <input type="radio" name="question['<?=$SecondQuestionID;?>']" value='3' />
        <input type="radio" name="question['<?=$SecondQuestionID;?>']" value='4' />
        <br />
        <input type=submit name=submit value=submit />
    </form>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want that the form will not close by doing Alt + F4 but
I have a PyQt4 class that displays a html form and fetches the input,
I have read other questions on this topic but none that actually answers my
Greetings! I'm doing a Form on ASP.NET MVC 2, in my view I have
For example, if I'm doing some form input validation and I'm using the following
I'm doing a windows form and would like an audit task to happen every
I'm doing a filter form in symfony2 and I try to preselect some filds.
what I am doing is creating a form using JSON this form can then
I'm doing jquery small animation of fade in to form validation This is working
I'm doing a jQuery AJAX post like this: var form = $(#formid); form.submit(function() {

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.