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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:55:47+00:00 2026-06-15T12:55:47+00:00

I would just like to ask how to best represent in database schema the

  • 0

I would just like to ask how to best represent in database schema the forms with radial button (Y/N) that if yes, would have an input field. Like “Are you taking medications right now?” (o) Yes or (o) No. If yes is selected, the input field would become available and they have to write it down. Currently I have this very simple schema:

tblUser
-----------
user_id

tblAnswers
--------------
answer_id
user_id
question_id
answer


tblquestions
----------------
question_id
question_text

I think the schema I have right now is fine for most things: multiple checkboxes as an answer, radial buttons, etc. But for radial buttons with dependent input field, I’m not sure. I would like to have it straightforward and simple by the way…I only have 1 survey per 1 user. And the questions won’t change for a long long time; perhaps even never. Then again, maybe my current schema would work for radial with input dependency…instead of Yes as an answer, I’ll have the input field value instead? So in tblanswer I could have an answer like Stress pills (instead of Yes) or No. Would that be acceptable? Or is that a bad idea? Any help would be greatly appreciated.

  • 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-15T12:55:49+00:00Added an answer on June 15, 2026 at 12:55 pm

    I will offer a solution to the radio button, i will not adress your table structure as it is irrelevant for this answer, but i’ll leave a tip here: forget normalization rules, they are impractical in most cases.

    Now, on to your problem, you are describing 3 possible outcomes (YES, NO, and TEXT) but in fact you have only 2 (NO and TEXT) as the existence of TEXT means already the answer was YES.

    So, what you should do is prepare your inputs to send “null” or “text”, use some javascript to show/hide a text input and get some logic behind the INSERT query to detect if it should save the input as null (for radio off) or as $_POST['foo'] (for radio on).

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

Sidebar

Related Questions

Just a knowledge question which I would like to ask: For example, I have
I would just like your feedback on something. Basically I have a value called
I just would like to know if it is possible (and if yes how)
I have an std::vector<unsigned char> with binary data in. I just would like to
I have an open question I would like to ask before starting development of
I would like to ask about best practices or the simplest way possible of
I have a bunch of php arrays that look like this (please don't ask
I would just like to know if there is any advantage to having a
I am new to coding and would just like to know a bit more
I'm debugging multi-threaded code and I would just like to know if a line

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.