473,320 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Passing three values with a single radio button

Apologies for what will doubtless be a dim question.

I'm using Dreamweaver to put together an online profiling app. The questions (really, a series of statements) come from a table called "profiling_questions" and I want to store the answers in a table called "profile_answers".

The user is presented with a statement, and then has to click 'agree', 'strongly disagree', etc. - 6 possible outcomes.

I want the new entry in 'profile_answers' to include the answer (which is easy enough) but also the values of two fields in 'profiling_questions' that are related to the answer, but which vary depending on which question has been asked.

So if the user is asked question ID 25, and selects 'strongly agree', there are two fields in 'profiling_questions' for question ID 25 called 'value_control_strag' and 'value_market_strag' that I want to store alongside the answer in 'profile_answers'. And similarly if the user selects 'slightly disagree' or whatever.

Dreamweaver 9's Developer Toolkit has built me a record insertion form that has several rows like this:

Expand|Select|Wrap|Line Numbers
  1. $ins_profile_answers->addColumn("answer", "STRING_TYPE", "POST", "answer");
the two key ones are:
Expand|Select|Wrap|Line Numbers
  1. $ins_profile_answers->addColumn("value_control", "DOUBLE_TYPE", "POST", "value_control", "{questions.value_control_strag}");
  2. $ins_profile_answers->addColumn("value_market", "DOUBLE_TYPE", "POST", "value_market", "{questions.value_market_strag");
I want the {questions.value_control_strag} at the end to vary depending on 'answer'.

I've tried putting if ... elseif clauses around the relevant $ins_profile_answers lines and I've also tried

Expand|Select|Wrap|Line Numbers
  1. $ins_profile_answers->addColumn("value_control", "DOUBLE_TYPE", "POST", "value_control", "{questions.value_control_".answer."}");
The first option entered every value as 0, the second every value as 1 (they should be either 10, 7, 3, -3, -7 or -10).

Any help very gratefully appreciated.
Jul 5 '07 #1
5 1806
kovik
1,044 Expert 1GB
Firstly, I highly recommend that you don't rely on Dreamweaver to code for you, as you'll run into dilemmas like this more than once.

My first question would be why you want to save those values and, if you've valid reason for doing so, why you're confused as to how to do it. When making relationships between tables, you need to save the values somewhere for later usage, so you'll need to somehow attach those values to the questions. You could do so through the 'name' attribute, and then use regex to retrieve it, or set up the names using arrays whose indexes correspond to the ids.
Jul 6 '07 #2
dafodil
392 256MB
Apologies for what will doubtless be a dim question.

I'm using Dreamweaver to put together an online profiling app. The questions (really, a series of statements) come from a table called "profiling_questions" and I want to store the answers in a table called "profile_answers".

The user is presented with a statement, and then has to click 'agree', 'strongly disagree', etc. - 6 possible outcomes.

I want the new entry in 'profile_answers' to include the answer (which is easy enough) but also the values of two fields in 'profiling_questions' that are related to the answer, but which vary depending on which question has been asked.

So if the user is asked question ID 25, and selects 'strongly agree', there are two fields in 'profiling_questions' for question ID 25 called 'value_control_strag' and 'value_market_strag' that I want to store alongside the answer in 'profile_answers'. And similarly if the user selects 'slightly disagree' or whatever.

Dreamweaver 9's Developer Toolkit has built me a record insertion form that has several rows like this:

Expand|Select|Wrap|Line Numbers
  1. $ins_profile_answers->addColumn("answer", "STRING_TYPE", "POST", "answer");
the two key ones are:
Expand|Select|Wrap|Line Numbers
  1. $ins_profile_answers->addColumn("value_control", "DOUBLE_TYPE", "POST", "value_control", "{questions.value_control_strag}");
  2. $ins_profile_answers->addColumn("value_market", "DOUBLE_TYPE", "POST", "value_market", "{questions.value_market_strag");
I want the {questions.value_control_strag} at the end to vary depending on 'answer'.

I've tried putting if ... elseif clauses around the relevant $ins_profile_answers lines and I've also tried

Expand|Select|Wrap|Line Numbers
  1. $ins_profile_answers->addColumn("value_control", "DOUBLE_TYPE", "POST", "value_control", "{questions.value_control_".answer."}");
The first option entered every value as 0, the second every value as 1 (they should be either 10, 7, 3, -3, -7 or -10).

Any help very gratefully appreciated.
Yeah, that's right... Don't rely on dreamweaver....

Dreamweaver should not replace your own logic of the code.....

And I can't understand how you want to pass those values using a radio button....

Can you show us the code of your html design...
Jul 6 '07 #3
Firstly, I highly recommend that you don't rely on Dreamweaver to code for you, as you'll run into dilemmas like this more than once.

My first question would be why you want to save those values and, if you've valid reason for doing so, why you're confused as to how to do it. When making relationships between tables, you need to save the values somewhere for later usage, so you'll need to somehow attach those values to the questions. You could do so through the 'name' attribute, and then use regex to retrieve it, or set up the names using arrays whose indexes correspond to the ids.
Thanks for the comment. Agreed I'd not ideally use Dreamweaver, but I am a newbie after all :-)

The issue is this. A user's profile is a position on two axes, let's call them A and B. The page draws a random statement from table QUESTION, and asks them to rate how strongly they agree/disagree. Their answer gives them a certain number of 'points' on each axis, with the number of points varying depending on (i) the question and (ii) whether they are agreeing or disagreeing. What those points values should be is in table QUESTION along with each statement.

I'm trying to store in a new row in ANSWERS, the user_id (done), the question_id (done), the answer (done) and the two numbers of points they have obtained for their answer (the problem).

I know I could also store just user_id, question_id and answer and then look up the points values in QUESTION when I come to calculate a user's total score, but that produces quite a complicated SQL query.
Jul 6 '07 #4
dafodil
392 256MB
Thanks for the comment. Agreed I'd not ideally use Dreamweaver, but I am a newbie after all :-)

The issue is this. A user's profile is a position on two axes, let's call them A and B. The page draws a random statement from table QUESTION, and asks them to rate how strongly they agree/disagree. Their answer gives them a certain number of 'points' on each axis, with the number of points varying depending on (i) the question and (ii) whether they are agreeing or disagreeing. What those points values should be is in table QUESTION along with each statement.

I'm trying to store in a new row in ANSWERS, the user_id (done), the question_id (done), the answer (done) and the two numbers of points they have obtained for their answer (the problem).

I know I could also store just user_id, question_id and answer and then look up the points values in QUESTION when I come to calculate a user's total score, but that produces quite a complicated SQL query.
To pass the user_id you need session so that you can detect who are the users who answered a questions and that means there should be a signup or login page.....

You could pass the question_id by naming every radio button according to their group and finally you could pass the value....

For example:

Expand|Select|Wrap|Line Numbers
  1. <input type="radio" name="group1" value="Milk"> Milk<br>
  2. <input type="radio" name="group1" value="Butter" checked> Butter<br>
  3. <input type="radio" name="group1" value="Cheese"> Cheese
  4.  
  5.  
By the way there is an article posted here about sessions please check the articles on php
Jul 6 '07 #5
To pass the user_id you need session so that you can detect who are the users who answered a questions and that means there should be a signup or login page.....

You could pass the question_id by naming every radio button according to their group and finally you could pass the value....

For example:

Expand|Select|Wrap|Line Numbers
  1. <input type="radio" name="group1" value="Milk"> Milk<br>
  2. <input type="radio" name="group1" value="Butter" checked> Butter<br>
  3. <input type="radio" name="group1" value="Cheese"> Cheese
  4.  
  5.  
By the way there is an article posted here about sessions please check the articles on php
Thanks, dafodil. The user id is working already (using sessions) and the question_id is also being passed in the current version. I'm really only having trouble with the two additional values that need to be looked up in QUESTIONS and passed to ANSWERS along with the user and question ids.
Jul 6 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: monika | last post by:
hi ... I have an asp page which has 3 buttons. <p align="center"><input class="button" type="button" onClick="location='welStudent.asp';" value="Click to write a new story"></p> <p...
12
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the...
2
by: jason | last post by:
The following (likely far from imperfect code), reports a value of NaN in the j4 display. I suppose the problem is I am not really passing the "checked" value of the radio button via .value ......
1
by: Dave Harris | last post by:
I am a raw newbie to VB.NET trying to convert a data processing QuickBasic program into .NET. I have about 14 forms, the first of which has a bank of radio buttons identifying the airline. The...
2
by: Eric Layman | last post by:
Hi, I have a radio button and a combo box. Upon changing a value for radio button, the combo box values will be dynamically updated. I have an idea on how to go abt doing it but Im stuck...
2
by: thanos | last post by:
Hello, How do i pass the value of the radio button to be put of the action that includes the value as part of the URL being submitted - "/ picked.php?pick_num=". Any help with be appreciated. ...
1
by: rmeganathan | last post by:
I have problem with passing radio button array in PHP. I am using multiple questions in the same page and each question contains 4 radio button choices. I am using arrary in the form. When I pass the...
10
by: sindhu | last post by:
hello there, as the title ggoes, i want to pass values btn html pages in the same frame. i've two framesets, top frmeset and bottom set, in the bottom frameset there are three frames, frame1,frame2...
3
by: ToddFur | last post by:
I see several postings on this but I am still unable to figure out my problem. I can pass the values of my text field but not radio button (or even checkboxes). My PHP file <?php //declare...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.