View Full Version : Trying to read form input
larkpics
04-07-2003, 08:58 AM
Hi. I am trying to do the following:
txt_cat = Request("cat" & int_ID)
txt_nam = Request("name" & int_ID)
txt_des = Request("desc" & int_ID)
Where cat, name, and desc plus an integer (int_ID) are text fields in a form. Any suggestions? My form method is post and I have tried using Request.Form(name+value) but nothing seems to work. Thanks.
bruce
04-07-2003, 09:52 AM
try
request.form("cat" & int_ID) if you are using post
[b]quote:Originally posted by larkpics
Hi. I am trying to do the following:
txt_cat = Request("cat" & int_ID)
txt_nam = Request("name" & int_ID)
txt_des = Request("desc" & int_ID)
Where cat, name, and desc plus an integer (int_ID) are text fields in a form. Any suggestions? My form method is post and I have tried using Request.Form(name+value) but nothing seems to work. Thanks.
</blockquote id="quote"></font id="quote">
Where are you getting the value of int_ID and are you sure it is the same on the form and on the receiving page?
try using
<%
Dim f
For Each f In Request.Form
Response.Write f & " = "
Response.Write Request.Form(f) & "
"
Next
%>
to make sure you are getting what you want.
[b]quote:Originally posted by larkpics
Hi. I am trying to do the following:
txt_cat = Request("cat" & int_ID)
txt_nam = Request("name" & int_ID)
txt_des = Request("desc" & int_ID)
Where cat, name, and desc plus an integer (int_ID) are text fields in a form. Any suggestions? My form method is post and I have tried using Request.Form(name+value) but nothing seems to work. Thanks.
</blockquote id="quote"></font id="quote">
Jon
(Information doesn't want to be free, it wants to be sixty-nine cents @ pound)
larkpics
04-08-2003, 07:29 AM
I can't believe I am having this much trouble with this:
---------------------THIS------------------
response.write "serviceID: " & int_ID & "
"
'txt_cat = Request.Form("cat" & int_ID)
'txt_nam = Request.Form("name" & int_ID)
'txt_des = Request.Form("desc" & int_ID)
txt_cat = Request.Form("cat0")
txt_nam = Request.Form("name0")
txt_des = Request.Form("desc0")
Response.Write "Category: " & txt_cat & "
Name: " & txt_nam & "
Description: " & txt_des & "
"
------------------RETURNS----------------------
serviceID: 0
Category:
Name:
Description:
INSERT INTO service (category,name,description) VALUES ('','','');
-----------------------------------------------
I have even hard coded it to the text field.
larkpics
04-08-2003, 08:44 AM
Here's the page in question
larkpics.com/ga/services.asp?e=edit (http://larkpics.com/ga/services.asp?e=edit)
larkpics
04-08-2003, 09:11 AM
Bruce,
Thanks for getting back to me. I did try
txt_cat = Request.Form("cat" & int_ID)
txt_nam = Request.Form("name" & int_ID)
txt_des = Request.Form("desc" & int_ID)
but it didn't work. This isn't rocket science but I must have missed something. I can't work on it right now but will try again tonight. Again, thanks for the advice.
bruce
04-08-2003, 10:00 AM
Post the error pls
[b]quote:Originally posted by larkpics
Bruce,
Thanks for getting back to me. I did try
txt_cat = Request.Form("cat" & int_ID)
txt_nam = Request.Form("name" & int_ID)
txt_des = Request.Form("desc" & int_ID)
but it didn't work. This isn't rocket science but I must have missed something. I can't work on it right now but will try again tonight. Again, thanks for the advice.
</blockquote id="quote"></font id="quote">
bruce
04-09-2003, 12:32 AM
I see that you button is a <a href>
I don't think you can do that with post method.
2 suggestions
a) Try use a submit button
or
b) try use request.querystring("cat0")
[b]quote:Originally posted by larkpics
Here's the page in question
larkpics.com/ga/services.asp?e=edit (http://larkpics.com/ga/services.asp?e=edit)
</blockquote id="quote"></font id="quote">
pjoyce
04-09-2003, 07:58 AM
If your button is an href, you have to submit manually through Javascript. As I recall it goes something like: <A href='mylink.asp' OnClick='Form1.submit();'> where Form1 is the name of the form in a form tag.
Just in case you are really doing a submit, one old ASP trick I used to use to tell if the IDs for my controls were correct was to change the form tag from 'post' to 'get'. When you do this, the IDs of the controls are shown in the Querystring so you can read them in the browser.
peter.
[b]quote:Originally posted by bruce
I see that you button is a <a href>
I don't think you can do that with post method.
2 suggestions
a) Try use a submit button
or
b) try use request.querystring("cat0")
[b]quote:Originally posted by larkpics
Here's the page in question
larkpics.com/ga/services.asp?e=edit (http://larkpics.com/ga/services.asp?e=edit)
</blockquote id="quote"></font id="quote">
</blockquote id="quote"></font id="quote">
CreativeLightning
04-10-2003, 10:11 AM
Well I'm not sure if you have fixed this or not but you have to close your request value or I'm certain you will get an error. Then add your int_ID.
txt_cat = Request("cat") & int_ID
Hope This Helps,
vBulletin® ©Jelsoft Enterprises Ltd.