Moving to Pages

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Vini171285
    New Member
    • Apr 2008
    • 60

    Moving to Pages

    Hi,
    This is my code
    Code:
    If (Request.Form("desc1")<>"") Then
    	Response.Redirect "SecondPage.asp"
    End If
    If (Request.Form("desc3")<>"") Then
    	Response.Redirect "ThirdPage.asp"
    End If
    I have a ASP page, in that there are 3 options.
    If i leave the first option blank it should move to third page..
    But it doesn't work.
    Can anyone help??
    Thanx..
  • DrBunchman
    Recognized Expert Contributor
    • Jan 2008
    • 979

    #2
    Hi Vini,

    To debug this replace your response.redire ct line with a response.write like this:
    Code:
    If (Request.Form("desc1")<>"") Then
    	Response.Write Request.Form("desc1")
    End If
    If (Request.Form("desc3")<>"") Then
    	Response.Write Request.Form("desc3")
    End If
    so you can check the value that is being passed in the form. Remember that if the first option is blank it won't necessarily redirect to the third page - you are testing whether desc3 is blank as well and if it is then it won't redirect. If you want it to always redirect when the first option is blank then you'll need to use:
    Code:
    If (Request.Form("desc1")<>"") Then
    	Response.Redirect "SecondPage.asp"
    Else
    	Response.Redirect "ThirdPage.asp"
    End If
    Dr B

    Comment

    • Vini171285
      New Member
      • Apr 2008
      • 60

      #3
      Hi Dr B,
      Actually i am having three list boxes named desc1,desc2,des c3.
      If desc1 is selected then it should go to second page..
      If desc2 is selected then it should go to third page..
      If desc3 is selected then it should go to fifth page..
      It is not necessary that if first is left blank,then it should go to third page..
      If first list box is blank it should check the next list box and should go to the respective pages.
      Can u suggest some line of code??
      Thanx..

      Comment

      • idsanjeev
        New Member
        • Oct 2007
        • 241

        #4
        are you trying to like this

        Code:
        If (Request.Form("desc1")<>"") Then
            Response.Redirect "SecondPage.asp"
        ElseIf (Request.Form("desc3")<>"") Then
            Response.Redirect "ThirdPage.asp"
        Else
         Response.Redirect "firstpage.asp")
        End If
        Regards
        Jha

        Comment

        • Vini171285
          New Member
          • Apr 2008
          • 60

          #5
          Hi,
          Yes i have tried this also..
          Thanx..

          Comment

          • idsanjeev
            New Member
            • Oct 2007
            • 241

            #6
            Originally posted by Vini171285
            Hi,
            Yes i have tried this also..
            Thanx..
            lets try this code
            Code:
            IF request.Form("desc1")<>"" Then
              If request.Form("desc2")<>"" Then
                if request.Form("desc3")<>"" then
                   response.Redirect ("thirdpage.asp")
                else
                 response.Redirect"secondpage.asp"
                End if
              Else
                 RESPONSE.Redirect "FIRSTPAGE.ASP" 
              end if
            else
              response.Redirect "page.asp"
            end if
            let us know what happen
            Regards
            jha

            Comment

            Working...