469,271 Members | 1,250 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,271 developers. It's quick & easy.

Moving to Pages

Vini171285
Hi,
This is my code
Expand|Select|Wrap|Line Numbers
  1. If (Request.Form("desc1")<>"") Then
  2.     Response.Redirect "SecondPage.asp"
  3. End If
  4. If (Request.Form("desc3")<>"") Then
  5.     Response.Redirect "ThirdPage.asp"
  6. End If
  7.  
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..
Jun 17 '08 #1
5 1266
DrBunchman
979 Expert 512MB
Hi Vini,

To debug this replace your response.redirect line with a response.write like this:
Expand|Select|Wrap|Line Numbers
  1. If (Request.Form("desc1")<>"") Then
  2.     Response.Write Request.Form("desc1")
  3. End If
  4. If (Request.Form("desc3")<>"") Then
  5.     Response.Write Request.Form("desc3")
  6. End If
  7.  
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:
Expand|Select|Wrap|Line Numbers
  1. If (Request.Form("desc1")<>"") Then
  2.     Response.Redirect "SecondPage.asp"
  3. Else
  4.     Response.Redirect "ThirdPage.asp"
  5. End If
  6.  
Dr B
Jun 17 '08 #2
Hi Dr B,
Actually i am having three list boxes named desc1,desc2,desc3.
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..
Jun 17 '08 #3
idsanjeev
241 100+
are you trying to like this

Expand|Select|Wrap|Line Numbers
  1. If (Request.Form("desc1")<>"") Then
  2.     Response.Redirect "SecondPage.asp"
  3. ElseIf (Request.Form("desc3")<>"") Then
  4.     Response.Redirect "ThirdPage.asp"
  5. Else
  6.  Response.Redirect "firstpage.asp")
  7. End If
Regards
Jha
Jun 17 '08 #4
Hi,
Yes i have tried this also..
Thanx..
Jun 17 '08 #5
idsanjeev
241 100+
Hi,
Yes i have tried this also..
Thanx..
lets try this code
Expand|Select|Wrap|Line Numbers
  1. IF request.Form("desc1")<>"" Then
  2.   If request.Form("desc2")<>"" Then
  3.     if request.Form("desc3")<>"" then
  4.        response.Redirect ("thirdpage.asp")
  5.     else
  6.      response.Redirect"secondpage.asp"
  7.     End if
  8.   Else
  9.      RESPONSE.Redirect "FIRSTPAGE.ASP" 
  10.   end if
  11. else
  12.   response.Redirect "page.asp"
  13. end if
let us know what happen
Regards
jha
Jun 17 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Rob R. Ainscough | last post: by
14 posts views Thread by rabbitrun | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.