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

post/get

Status
Not open for further replies.

exodus300

Programmer
Mar 22, 2002
262
AU
can u have post (Request.Form("abc")) and get (Request("xyz")) on the same page, for example:

<form method=&quot;post&quot; action=&quot;something.asp?something=something&quot;>
<input type=&quot;checkbox&quot; value=&quot;yes&quot;>
<input type=&quot;submit&quot; value=&quot;Submit&quot;>
</form>

something.asp
If Request.Form(&quot;abc&quot;) = &quot;yes&quot; And Request(&quot;something&quot;) = &quot;something&quot; Then... [pc3]
 
First you need to specify a name for each item:

<form method=&quot;post&quot; action=&quot;something.asp?something=something&quot;>
<input type=&quot;checkbox&quot; name=&quot;abc&quot; value=&quot;yes&quot;>
<input type=&quot;submit&quot; value=&quot;Submit&quot;>
</form>

You can only have one Get or one Post per input form, with Get passing data via a query string in the actuall URL (so passed info can be viewed in address bar of browser), while Post passes data directly to target URL when the page has been contacted.

You can then use request.form(&quot;name&quot;) for post data or request.querystring(&quot;name&quot;) for get data. Both can be used on the same page.

Using request(&quot;name&quot;) isn't get, rather just a shortcut of requesting the named item, whether sent by Get or Post. As long as names aren't duplicated, you can use it to recieve any item.

Hope that helps.
 
Sorry, got a bit carried away and didn't fully answer your question (though all of the above still applies).

You can do what you're trying to do, because the form action is simply providing a querystring with a name-value pair. The form itself is not submmitting with the Get method.

Get sends form data via a querystring, whereas you are defing the URL manually, which has the same effect but is not Get.

In your asp page you can get it by:
Request.querystring(&quot;something&quot;) or request(&quot;something&quot;).
 
I myself try to keep information away from the user. so rather than using:
<form method=&quot;post&quot; action=&quot;something.asp?something=something&quot;>

I would use

<input type = &quot;hidden&quot; name = &quot;something&quot; value = &quot;something&quot;>

then instead of using:

If Request.Form(&quot;abc&quot;) = &quot;yes&quot; And Request(&quot;something&quot;) = &quot;something&quot; Then

I would use
if request.form(&quot;abc&quot;) = &quot;yes&quot; and request.form(&quot;something&quot;) = &quot;something&quot; then
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top