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!

How to access variables when submitted via POST method.

Status
Not open for further replies.

Jables

Programmer
Aug 28, 2001
148
US
I need to pass variables from page to page. I have a form on the first page that uses the POST method and puts the form values into a database table. This form is where users of the site define a profile of themselves. So I would like for them to be directed to a page showing them what their formatted profile looks like(i.e. all the data they just entered appears in a nice little table).

The chain of events should go something like this:

1. User enters data into form
2. Page sends the data via the POST method
3. Data gets inserted into database
4. User is redirected to Formatted Profile page
5. Display a filtered recordset (page only shows their profile).

I would like to accomplish step 5 by just passing the username entered in the form by the new user to the formatted profile page. I can do this with GET, but I need to use POST in order to insert the records into the database.

So how do I access the variables on the next page when they were submitted via the POST method on the previous page?

Help is much appreciated.
Clay Simmons
 
I have a text box on my form called Vendor


<%
Value=request.querystring(&quot;Vendor&quot;)
%>

<form action=&quot;TradeShow2003.asp&quot; method=&quot;post&quot; name=&quot;FrontPage_Form1&quot;>

So I'm posting to the same form TradeShow2003.asp that this code is in.
DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
Sorry, I'm a bit of a beginner, and I'm afraid I don't follow exactly. Are you saying to redirect to the same page? I guess I could do that, but I would really like to send them to another page.

Couldn't I just set a variable equal to the value that's entered into the username field on the form and then append that to the URL redirect?

Like if the form field is called &quot;username&quot;.

Variable = yadayada(&quot;username&quot;)

And then:

MM_RedirectURL = &quot;/formattedprofile.asp?username=(&quot;username&quot;)&quot;

If so, how do I refer to the textfield on the form? Like I said, I'm kind of new to ASP.

Thanks

 
Oops, that should've read.

MM_RedirectURL = &quot;/formattedprofile.asp?username=(&quot;Variable&quot;)&quot;

 
if are using IIS5.0, you can use server.transfer() function
to transfer the posted data to another web page without
any other redirecton.
 
Why not use a session variable?

In Step 1

Code:
<form method=&quot;post&quot; etc.>
<input type=text name=&quot;who&quot;>
</form>


In Step 3

Code:
<% 
Session(&quot;who&quot;) = Request.Form(&quot;who&quot;);
etc.
  %>


In Step 5

Code:
var myGuy = Session(&quot;who&quot;);

etc.

qProfile = &quot;SELECT * FROM visitor_table WHERE name='&quot; + myGuy;

rsProfile.open(qProfile, conn);


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top