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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:25:57+00:00 2026-06-07T16:25:57+00:00

All, I’m allowing my user to create questions which I’ll need to save answers

  • 0

All,
I’m allowing my user to create questions which I’ll need to save answers to. They can create as little or as many questions as they would like. My dilemma is how to save these variables and also retrieve and display them back to the user.

When I output the form to the user I have the following PHP code (I have the questions stored in a different table as well as the answers that are applicable in a different table):

$qryquestion = "Select * from feedback_questions order by question_display ASC";
$resultquestion = mysql_query($qryquestion);
$i=1;
while($resultsetquestion = mysql_fetch_array($resultquestion)){
if ($i%2==0){
    echo '<tr bgcolor="#FFFFFF" id="row'.$i.'">';
} else {
    echo '<tr id="row'.$i.'">';
}
echo '<td align="center"><b>'.$resultsetquestion['question_value'].'</b></td>';
echo '<td align="center"><div style="text-align:center;"><input type="radio" name="rating_value_'.$resultsetquestion['question_id'].'" id="rating_value_'.$resultsetquestion['question_id'].'" value="'.$resultsetratings['rating_id'].'"></td>';
}

I was thinking about saving them in the db like the following:

user_id     question_id     answer_id    feedback_id
1           1               5            1
1           2               5            1
1           3               1            1
2           1               2            2

How would I save these variables from a $_POST perspective when the form gets submitted?

  • 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-07T16:25:57+00:00Added an answer on June 7, 2026 at 4:25 pm

    Since you’re using PHP, the easiest method to handle arbitrary numbers of questions will be to convert your inputs into a PHP array once POSTed, as specified here. An example with a PHP implementation can be found here. Once you actually have the input data in a PHP array, you can just add them to the database. Your database layout looks appropriate enough, though you could probably get away with actually including the question and answer in the same table, to save on joins.

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

Sidebar

Related Questions

All my files can be found on GitHub: https://github.com/Integralist/Passage (just in case you need
All the talk on WP7 resolution = 800x480. I can create more than 480
all creating a cakephp(using 2.1.2) page. we prompt the user to enter how many
All I need is to know if something exists and how many times it
All, How can I bind the array of drop down list items returned from
All math functions in JavaScript use radians in place of degrees. Yet they are
All, is there any means by which it is possible to connect to two
I would like to run a str_replace or preg_replace which looks for certain words
I have a text area in my form which accepts all possible characters from
All of my elements which init by my jquery plugin sharing the same local

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.