Forum: Ruby Form issue

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
chadmaester (Guest)
on 2006-03-08 19:05
(Received via mailing list)
I have a dilema. I have an HTML form which is in a test format, and the
form has multiple questions, and each question has multiple radio
buttons. I need a way to distinguish which question each set of radio
buttons belongs to, and I can't think of a way to do this.

This is basically what the form looks like:

Question #1
<input name="survey_results[answer]" type="radio" value="1" />
<input name="survey_results[answer]" type="radio" value="2" />
<input name="survey_results[answer]" type="radio" value="3" />

Question #2
<input name="survey_results[answer]" type="radio" value="1" />
<input name="survey_results[answer]" type="radio" value="2" />
<input name="survey_results[answer]" type="radio" value="3" />


And this is the database table the test results are being saved to:

survey_results
	id : int
	student_id : int
	question_id : int
	answer : int

Is there a way to somehow hardcode what the value of the question_id
field for each question should be? What can I do?
This topic is locked and can not be replied to.