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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

request.form won't work

Status
Not open for further replies.

frosty7700

Programmer
Aug 10, 2001
95
US
I am having a problem that is driving me insane. I have an ASP file with the following code in it:

<INPUT TYPE=&quot;text&quot; SIZE=&quot;40&quot; NAME=&quot;description&quot;></font>

This line is in a table that is within FORM tags. The opening FORM tag is:

<form method=&quot;POST&quot; ACTION=&quot;test.asp?Type=Image&id=<%=request.querystring(&quot;id&quot;)%>&name=<%=request.querystring(&quot;name&quot;)%>&quot;>

Test.asp consists of the following:

Dim x
x = request.form(&quot;description&quot;)
response.write(&quot;x = &quot; & x)

However, it (x) always comes up blank. Does anyone have any idea what can cause this? I'll say again, the input field IS between the form tags.
 
You are actually sending a QueryString not a POST when you tack on parameters in the ACTION tag.

You could send it in the POST by doing the following:
Code:
<form method=&quot;POST&quot; ACTION=&quot;test.asp&quot;>
<input type=&quot;hidden&quot; name=&quot;Type&quot; value=&quot;Image&quot;>
<input type=&quot;hidden&quot; name=&quot;id&quot; value=&quot;<%=request.querystring(&quot;id&quot;)%>&quot;>
<input type=&quot;hidden&quot; name=&quot;name&quot; value=&quot;<%=request.querystring(&quot;name&quot;)%>&quot;>
<input type=&quot;submit&quot;>
</form>
Wushutwist
 
Actually, this isn't the problem. It is in fact possible to post form data and send a querystring together. For example, if you write the following code in one file:

<form method=&quot;post&quot; action=&quot;test.asp?h=1&quot;>
<input type=&quot;text&quot; name=&quot;hi&quot;>
<input type=&quot;submit&quot; value=&quot;go&quot;>
</form>

and then create the file test.asp with the following:

<%
x = request.querystring(&quot;h&quot;)
response.write(&quot;x = &quot; & x)
x = request.form(&quot;hi&quot;)
response.write(&quot; x = &quot; & x)
%>

everything will work fine. Which is why I don't know why my code isn't working, because I've done this many times before as just described (in fact I tried the above test just to make sure right before posting this).
 
I copied your code verbatim as you have it above and it works fine. Are you sure that you don't have a typo in the original code?

Tazzmann
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top