Copy link to clipboard
Copied
I query a database for names and different grades for subjects. For example, I requested for "Mary" and the database returns more than one "Mary". So I displayed the different "Mary" with a cfform and list all the "Mary" with a radio button and let user choose the right "Mary".
e.g.
cfquery...
if more than one student with same name then
<cfform action="nextprogram">
<cfoutput query=list>
<cfinput type=radio name=studentname value=#studentname#>#studentname#, #studentlastname#
<cfinput type=hidden name=math value=#math#>
<cfinput type=hidden name=physic value=#physic#>
....
</cfoutput>
</cfform>
Of course, I realize this will not work because if there are 10 "Mary" and I select the first "Mary", the application will not know which math, physic grades etc. belong to the first "Mary". Since I have already done the database query with all the information retrieved, I don't want to do a database query again. How do I pass the all the information belong to the chosen "Mary" to the "nextprogram"? This is probably very easy to do with different CF tag, but I haven't used Coldfusion for a while, so any help is appreciated. Thank you.
Jack
Copy link to clipboard
Copied
Instead of value = studentname, use value = studentid
Copy link to clipboard
Copied
Hi Dan,
Even if I pass studentid that still won't work. I still need to somehow pass all the grades associated with the selected studentid to the secondprogram.
Jack
Copy link to clipboard
Copied
You could always pass a list and process it on the next page. Something like
name=Mary Smith,physics=85,math=50
Copy link to clipboard
Copied
The user select the right "Mary" from a list of names starting with "Mary" via input radio button. I need to find a way to pass all the retrieved information for the selected Mary through the form.