ASP Forms "Get" Server Variables

Discussion in 'ASP General' started by Harry, Sep 10, 2003.

  1. Harry

    Harry Guest

    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
    %>
     
    Harry, Sep 10, 2003
    #1
    1. Advertising

  2. > if request.ServerVariables("terms_conditions") = agree then

    Did you mean

    if request.QueryString("terms_conditions") = "agree" then
     
    Aaron Bertrand - MVP, Sep 10, 2003
    #2
    1. Advertising

  3. Harry

    Ray at Guest

    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" <> wrote in message
    news:...
    > 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
    > %>
     
    Ray at, Sep 10, 2003
    #3
  4. Harry

    Tom B Guest

    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:%...
    > 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" <> wrote in message
    > news:...
    > > 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
    > > %>

    >
    >
     
    Tom B, Sep 10, 2003
    #4
  5. Harry

    Ray at Guest

    Uh, Dad.

    Ray (not Rae) at work

    "Tom B" <> wrote in message
    news:...
    >
    >
    > Yes Mom.
     
    Ray at, Sep 10, 2003
    #5
  6. 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" <> wrote in message
    news:...
    > 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
    > %>
     
    Boris Nikolaevich, Sep 11, 2003
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jessica Loriena

    New to ASP.Net forms (and Session variables??)

    Jessica Loriena, Jul 30, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    972
    Kevin Spencer
    Jul 30, 2003
  2. jlopes151
    Replies:
    2
    Views:
    639
    Steve C. Orr [MVP, MCSD]
    Mar 14, 2005
  3. Replies:
    9
    Views:
    956
  4. Toni Pohl
    Replies:
    1
    Views:
    950
    Toni Pohl
    Aug 10, 2008
  5. Eric
    Replies:
    2
    Views:
    541
Loading...

Share This Page