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

Not reading *posted* variables

Status
Not open for further replies.

LarrySteele

Programmer
May 18, 2004
318
US
Haven't worked with .asp for years, but can't imagine I'm that far off.

I'm trying to POST variables to a .asp page. For some reason, the receiving page does not see the variables.

My posting page
Code:
<form name="sso_logon" method="post" action="[URL unfurl="true"]http://somepage.asp">[/URL]
<cfoutput query="get_key">
    <input type="text" name="personid" value="123" />
    <input type="text" name="pers_key" value="ABC" />
</cfoutput>
</form>

My receiving page
Code:
<%

    pers_key = request("pers_key")
    pin = escape(request("pin"))

    response.write("pers_key: " & pers_key & "<br>")
    response.write("pin: " & pin)

%>

On the receiving page, I get this:

[tt]
pers_key:
pin:
[/tt]

If I change from POST to GET, the receiving page displays the variables:

Code:
<form name="sso_logon" method="get" action="[URL unfurl="true"]http://somepage.asp">[/URL]
<cfoutput query="get_key">
    <input type="text" name="personid" value="123" />
    <input type="text" name="pers_key" value="ABC" />
</cfoutput>
</form>

So, from the GET method, the receiving page displays this:
On the receiving page, I get this:

[tt]
pers_key: 123
pin: ABC
[/tt]

I do not want to have form variables visible, hence my desire to POST the variables.

I tried using Request.Form(), but that had no effect - variables only appeared when using the GET method. I've stopped by 4Guys, and took several strolls through Google. So far, no joy.

Am I missing something???

Assistance would be GREATLY appreciated!
 
how are you submitting the page (i.e.submit button).

Also, what's with the cold fusion code within the form? I don't know anything about CF, is that suppose to output extra values?

this should work, but i don't know why it won't for you - maybe it has something to do with the CF?


Code:
<form method="post" action="rec.asp">
<input type="text" name="mytbx" value="123">
<input type="submit" value="submit">
</form>

Code:
<%
response.write request.form("mytbx")
%>

--------
GOOGLE is a great resource to find answers to questions like "how do i..."

If you don't know exaclty what you want to do or what to search on, try Google Suggest: --------
I have recently been semi-converted to ensuring all my code (well most of it) works in both javascript and non-javasc
 
I believe the main reason you are having problems is that in your form you have two inputs: personid & pers_key. But on your asp page you are requesting: pers_key & pin. The names need to match on both pages.
 
vicvirk: I'm using a CF page as an intermediate step before heading out and you're seeing some CF code remnants. While that wouldn't have any bearing on the receiving page, it's a valid question.

red24698: I sure hope I had a copy/paste error from pages to forum. I'd hate to think I did something as silly as gave my sending/receiving variables different names.

Thanks to both for your suggestions. I'm on the road, and will check when I'm back in the office on Monday.
 
Hm. Yep, I had a typo in my original post.

Code:
<form name="sso_logon" method="post" action="[URL unfurl="true"]http://somepage.asp">[/URL]
<cfoutput query="get_key">
    <input type="text" name="pers_key" value="123" />
    <input type="text" name="pin" value="ABC" />
</cfoutput>
</form>

This is a ColdFusion page that pulls info from one of our databases. It then pushes the retrieved data to an ASP page on a different server. Again, this does not work when I use a POST method. If I change POST to GET, everything flows through with no problem.

Is it possible that the problem is that I'm attempting to POST to a different server? Or that I'm trying to POST from ColdFusion to ASP? I wouldn't think these should have any bearing. Maybe I'm just grabbing for straws...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top