Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > ASP Forms "Get" Server Variables

Reply
Thread Tools

ASP Forms "Get" Server Variables

 
 
Harry
Guest
Posts: n/a
 
      09-10-2003
Hi All,

Can anyone clever out there tell me why the below script does not
work!
- I have a page with two radio boxes with values of "agree" and
"not_agree".
- The form is set to GET which goes to the below script for
processing.
- No matter which of the two radio boxes are selected, it always goes
to the page "/broadband/order.asp".
- There is no other code on the form processing page apart form what
is below.
- PLEASE HELP

Thanks
H


<%
if request.ServerVariables("terms_conditions") = agree then
response.Redirect("/broadband/order.asp")
else
response.Redirect("/default.asp")
end if
%>
 
Reply With Quote
 
 
 
 
Aaron Bertrand - MVP
Guest
Posts: n/a
 
      09-10-2003
> if request.ServerVariables("terms_conditions") = agree then

Did you mean

if request.QueryString("terms_conditions") = "agree" then


 
Reply With Quote
 
 
 
 
Ray at
Guest
Posts: n/a
 
      09-10-2003
When you use GET with a form you pull values from REquest.Querystring, not
REquest.Servervariables.

Also, you'll want to delimit agree. Try this:

If Request.Querystring("term_conditions") = "agree" Then
Response.Write "It will redirect to order.asp after I am finished
debugging and add the redirect code."
Else
Response.Write "It will redirect to default.asp after I am finished
debugging and add the redirect code. I will never put redirect code in
until I have my conditional statements working propery so that things are
easier to debug. I will use response.write often while debugging, and I
will also often use response.end."
End If



Ray at work


"Harry" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> Hi All,
>
> Can anyone clever out there tell me why the below script does not
> work!
> - I have a page with two radio boxes with values of "agree" and
> "not_agree".
> - The form is set to GET which goes to the below script for
> processing.
> - No matter which of the two radio boxes are selected, it always goes
> to the page "/broadband/order.asp".
> - There is no other code on the form processing page apart form what
> is below.
> - PLEASE HELP
>
> Thanks
> H
>
>
> <%
> if request.ServerVariables("terms_conditions") = agree then
> response.Redirect("/broadband/order.asp")
> else
> response.Redirect("/default.asp")
> end if
> %>



 
Reply With Quote
 
Tom B
Guest
Posts: n/a
 
      09-10-2003

Response.Write "It will redirect to default.asp after I am finished
debugging and add the redirect code. I will never put redirect code in
until I have my conditional statements working propery so that things are
easier to debug. I will use response.write often while debugging, and I
will also often use response.end."


Yes Mom.



"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:%(E-Mail Removed)...
> When you use GET with a form you pull values from REquest.Querystring, not
> REquest.Servervariables.
>
> Also, you'll want to delimit agree. Try this:
>
> If Request.Querystring("term_conditions") = "agree" Then
> Response.Write "It will redirect to order.asp after I am finished
> debugging and add the redirect code."
> Else
> Response.Write "It will redirect to default.asp after I am finished
> debugging and add the redirect code. I will never put redirect code in
> until I have my conditional statements working propery so that things are
> easier to debug. I will use response.write often while debugging, and I
> will also often use response.end."
> End If
>
>
>
> Ray at work
>
>
> "Harry" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) om...
> > Hi All,
> >
> > Can anyone clever out there tell me why the below script does not
> > work!
> > - I have a page with two radio boxes with values of "agree" and
> > "not_agree".
> > - The form is set to GET which goes to the below script for
> > processing.
> > - No matter which of the two radio boxes are selected, it always goes
> > to the page "/broadband/order.asp".
> > - There is no other code on the form processing page apart form what
> > is below.
> > - PLEASE HELP
> >
> > Thanks
> > H
> >
> >
> > <%
> > if request.ServerVariables("terms_conditions") = agree then
> > response.Redirect("/broadband/order.asp")
> > else
> > response.Redirect("/default.asp")
> > end if
> > %>

>
>



 
Reply With Quote
 
Ray at
Guest
Posts: n/a
 
      09-10-2003
Uh, Dad.

Ray (not Rae) at work

"Tom B" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
>
> Yes Mom.



 
Reply With Quote
 
Boris Nikolaevich
Guest
Posts: n/a
 
      09-11-2003
In addition to everything else that has been said, using "Option Explicit"
on every ASP page I write has helped me with things like what you
encountered. It is optional (for some, not to me), but in your case it
would have raised an error that you hadn't defined the variable "agree" (no
quotes), helping you to identify the problem sooner.

(and BTW, I have to add with a grin that "Yes, Mom" was appropriate, because
it was said exactly the way I used to say it to my brother when he was doing
his self-righteous finger-wagging. Has nothing to do with gender or with
the fact that Ray was very right about his effective development practices.)


"Harry" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> Hi All,
>
> Can anyone clever out there tell me why the below script does not
> work!
> - I have a page with two radio boxes with values of "agree" and
> "not_agree".
> - The form is set to GET which goes to the below script for
> processing.
> - No matter which of the two radio boxes are selected, it always goes
> to the page "/broadband/order.asp".
> - There is no other code on the form processing page apart form what
> is below.
> - PLEASE HELP
>
> Thanks
> H
>
>
> <%
> if request.ServerVariables("terms_conditions") = agree then
> response.Redirect("/broadband/order.asp")
> else
> response.Redirect("/default.asp")
> end if
> %>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PDF forms filling with ASP.NET, interactive forms, fill and write to database (iText or FDF Toolkit or ...) Toni Pohl ASP .Net 1 08-10-2008 01:40 PM
Put variables into member variables or function variables? tjumail@gmail.com C++ 9 03-23-2008 04:03 PM
forms authentication -- expired forms cookie vs. not provided forms cookie Eric ASP .Net Security 2 01-27-2006 10:09 PM
Creating ASP.NET forms, that act like HTML forms jlopes151 ASP .Net 2 03-14-2005 01:01 AM
New to ASP.Net forms (and Session variables??) Jessica Loriena ASP .Net 2 07-30-2003 12:23 PM



Advertisments