Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Choosing Radio buttons on Submit.

Status
Not open for further replies.

Castanz

Programmer
Apr 5, 2002
61
0
0
US
Hi All,

I am stuck on this one. If this were Access I would have no problems. I divided this into three pages. First page takes the information the date of the meals and the filter. Second page has the following code. The idea is to choose the radio button of the meal choice for each user. The only problem is when I try to request the information from the second page to the third. On the third page, I can't use
Code:
RS("Mealchoice")=request("mvalue & mcount")
or can I using a response.write?

I thought about storing the values in an array then passing them to the third page. Not sure how to pass an array from one ASP page to another.

Code:
Response.write "<form method='post' action='GroupAccessConfirm.asp'>"
MChoice1="Ham"
MChoice2="Turkey"
choice = Request("Mealrequested")
mcount = 0    
   Do While (Not RS.EoF) %>
      <%CurrMealCard = Rs("MealCard")%>
      <input type="text" readonly="READONLY" name="FirstName" size="15" maxlength="20" value="<%=Rs("FirstName")%>">
      <input type="text" readonly="READONLY" name="LastName" size="15" maxlength="20" value="<%=Rs("LastName")%>">
      <input type="text" readonly="READONLY" name="RateRank" size="6" maxlength="10" value="<%=Rs("RateRank")%>">
      <input type="hidden" readonly="READONLY" name="Command" size="10" maxlength="20" value="<%=Rs("Command")%>">
      <input type="text" readonly="READONLY" name="CurrMealCard" size="10" maxlength="20" value="<%=CurrMealCard%>">
      <%
	mcount = mcount + 1
	response.write "None:<input type='radio' name='Mvalue" & mcount & "' size='10' maxlength='20' checked value= 'None'> "
	response.write MChoice1 &_ 
	":<input type='radio' name='Mvalue" & mcount & "' size='10' maxlength='20' value=" &_
	MChoice1 & "'> "
	response.write MChoice2 &_ 
	":<input type='radio' name='Mvalue" & mcount & "' size='10' maxlength='20' value=" &_
	MChoice2 & "'><br>"
  
      Rs.MoveNext 
   Loop


Any help would be greatly appreciated.
Thanks in advance,
Al
 
Perhaps I'm missing something easy, but I am not sure exactly what your problem is. Can you please clarify? What I understand at this point is that you have information that you pass from page 1 to page 2 (presumably using a form and POST). However, you cannot pass that information from page 2 to page 3. Is that code you have above (the larger section) the relevant code on page 2 that you are trying to pass to page 3? If not, can we see the relevant code for page 2 that should be passed to page 3? And how are you attempting to call the information on page 3 (again, relevant code would be useful)? Thanks.

------------------------------------------------------------------------------------------------------------------------
"As for the bureacratic, politically-correct, mollycoddling, asinine, Romper Room antics of...clients and management, just read up on Dilbert. It's not funny - it's a training manual."
- Mike
 
Thank you for replying.

Maybe it is easy, but I am stuck. I know how to retrieve one field
Code:
request("Mvalue1")
or if I knew how many I would retrieve
Code:
request("Mvalue1")
request("Mvalue2")
request("Mvalue3")
request("Mvalue4")
How would I retrieve an indeterminate amount of fields?

Is there an easier way to do this?

Thanks again,
Al
 
Just iterate through the Request.Forms collection. See
___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
It's been a while since I've done anything like this, but....

[tt][blue]
For Each RequestValue In Request.Form
If Left(RequestValue, 6) = "Mvalue" Then
Response.Write RequestValue & "=" & Request.Form(RequestValue) & "<br/>"
End If
Next
[/blue][/tt]

This may not be exactly right, but it should be close. If this does NOT work for you, then I would suggest a google search with the following terms [google]ASP For Each Request.Form[/google].

Hope this helps.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Ok, I think I see where you're going. You would have to do something similar to what you suggested earlier - using an array. You may be able to use the dictionary object (from my vague recollections of how it works, but I've never used it myself so I can't say for certain). But to generate the array, just use a for/next statement. Something akin to:
Code:
for each obj in request.form
  [COLOR=green]'create your array of values here of whatever you need.[/color]
next

------------------------------------------------------------------------------------------------------------------------
"As for the bureacratic, politically-correct, mollycoddling, asinine, Romper Room antics of...clients and management, just read up on Dilbert. It's not funny - it's a training manual."
- Mike
 
Hey chops. That's exactly what I would have done.


-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
Doug needs a new pair of shoes, please click an ad link.
 
George,

I would say that great minds think alike, but that would imply that I have one and that might be going a little too far in my case... :)

------------------------------------------------------------------------------------------------------------------------
"As for the bureacratic, politically-correct, mollycoddling, asinine, Romper Room antics of...clients and management, just read up on Dilbert. It's not funny - it's a training manual."
- Mike
 
[rofl]

------------------------------------------------------------------------------------------------------------------------
"As for the bureacratic, politically-correct, mollycoddling, asinine, Romper Room antics of...clients and management, just read up on Dilbert. It's not funny - it's a training manual."
- Mike
 
If you write mcount to a hidden form element then you wont have to wonder how many there are:[tt]
<input type="hidden" name="MaxCount" value="<%= mcount%>">

 
Nice to see that you all followed my earlier example! Must admit I was too lazy to write out a complete code solution though[smile]

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
John, you're an inspiration to us all... :)

------------------------------------------------------------------------------------------------------------------------
"As for the bureacratic, politically-correct, mollycoddling, asinine, Romper Room antics of...clients and management, just read up on Dilbert. It's not funny - it's a training manual."
- Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top