Sign In | Register Now About Bytes | Help | Site Map
Connecting Tech Pros Worldwide

Problem with Pages in ASP

Question posted by: Vini171285 (Member) on May 11th, 2008 09:02 AM
Hi..
I have a form,it consists of a six list boxes and depending on selection of that boxes i have to display six pages ..
i have used an array to store these values and case to go to particular pages,but the problem is all pages come in one window..
and i want that,first page should come user can fill it and after submitting that page,the next page stored in array should come..
so what can i do??
Expand|Select|Wrap|Line Numbers
  1. arrdesc=Array(Request.Form("desc1"),Request.Form("desc2"),Request.Form("desc3"),Request.Form("desc4"),Request.Form("desc5"),Request.Form("desc6"))
  2. Dim desc
  3. for each desc in arrdesc
  4.     select case desc
  5.         case 1
  6.             SecondPage()
  7.         case 2
  8.             SecondPage()
  9.         case 3
  10.             SecondPage()
  11.         case 4
  12.             ThirdPage()
  13.         case 5
  14.             ThirdPage()
  15.                                 case 6
  16.                                                 FifthPage()
  17.                                 case 7
  18.                                                 FifthPage()
  19.                                 case 8
  20.                                                 FifthPage()
  21.         case 9
  22.             FourthPage()
  23.     end select
  24. Next
shweta123's Avatar
shweta123
Expert
641 Posts
May 11th, 2008
03:00 PM
#2

Re: Problem with Pages in ASP
Hi ,

You can do modification in your code like this :

On Page1.asp , you should write following code :

Expand|Select|Wrap|Line Numbers
  1.  <HTML>
  2.       <BODY>
  3.      <form method="post" action "Page2.asp">
  4.       <Select id= "pageSelect">
  5.       <Option value="page1">Page1.asp</Option>
  6.      <Option value="page2">Page2.asp</Option>
  7.       </Select>
  8.      </form>
  9.       <BODY>
  10.        </HTML>



On Page2.asp write the code below :

Expand|Select|Wrap|Line Numbers
  1.   <%
  2.      Dim page
  3.       page=Request.Form("pageSelect")
  4.      Select page
  5.      Case "page1"
  6.             Response.redirect "Page1.asp"
  7.  
  8.     Case "page2"
  9.            Response.redirect "Page2.asp"
  10.  
  11.     End Select
  12.    %>
  13.  







Quote:
Hi..
I have a form,it consists of a six list boxes and depending on selection of that boxes i have to display six pages ..
i have used an array to store these values and case to go to particular pages,but the problem is all pages come in one window..
and i want that,first page should come user can fill it and after submitting that page,the next page stored in array should come..
so what can i do??
Expand|Select|Wrap|Line Numbers
  1. arrdesc=Array(Request.Form("desc1"),Request.Form("desc2"),Request.Form("desc3"),Request.Form("desc4"),Request.Form("desc5"),Request.Form("desc6"))
  2. Dim desc
  3. for each desc in arrdesc
  4.     select case desc
  5.         case 1
  6.             SecondPage()
  7.         case 2
  8.             SecondPage()
  9.         case 3
  10.             SecondPage()
  11.         case 4
  12.             ThirdPage()
  13.         case 5
  14.             ThirdPage()
  15.                                 case 6
  16.                                                 FifthPage()
  17.                                 case 7
  18.                                                 FifthPage()
  19.                                 case 8
  20.                                                 FifthPage()
  21.         case 9
  22.             FourthPage()
  23.     end select
  24. Next

Reply
Vini171285's Avatar
Vini171285
Member
60 Posts
May 18th, 2008
09:22 AM
#3

Re: Problem with Pages in ASP
Hi Shweta,
Thanx for answering but u got my question wrong..

My problem is...
I am having 6 listboxes consisting of same options..
minimum 1 can be selected or maximum all 6 can be selected..
so suppose 2 are selected then we should go to first options page after submitting that page ,then we should go to second options page..
i.e. one by one it should go to pages as per selected in listboxes..
Hope this time i am clear..
Thanx..

Reply
shweta123's Avatar
shweta123
Expert
641 Posts
May 19th, 2008
04:36 PM
#4

Re: Problem with Pages in ASP
Hi,

After submitting main page on First.asp write this code :

Expand|Select|Wrap|Line Numbers
  1. <%
  2. Dim Pages()
  3.  
  4.  
  5. 'Get the listbox values into the array
  6. Pages(0) = Request.Form("lst1")
  7. '
  8. '
  9. '
  10. Redim preserve Pages(Ubound(Pages)+1)
  11. pages(Ubound(Pages))= Request.Form("lst6")
  12.  
  13.  
  14. ''Store the arry in session variable
  15. Session("myArray") = pages
  16.  
  17.  
  18. ''Redirect to first options page
  19.  
  20. If(pages(0) <> "") then
  21.   Response.redirect(Pages(0) & "&Cnt =1")
  22. End if%>



On Second.asp write this code :
Expand|Select|Wrap|Line Numbers
  1. <%
  2. Dim localarr
  3. Dim arrindex
  4.  
  5. localarr = Session("myArray")
  6. arrindex = REquest.QueryString("cnt")
  7.  
  8. ''Check if array index is within array bounds
  9. If(arrindex <= Ubound(localarr)) Then
  10.  
  11.   ''Redirect to next Options page  
  12.   If(localarr(arrindex) <> "") Then
  13.       Response.redirect(Pages(arrindex+1) & "&Cnt = "& cnt & "")
  14.   End If
  15. End if
  16. %>



Quote:
Hi Shweta,
Thanx for answering but u got my question wrong..

My problem is...
I am having 6 listboxes consisting of same options..
minimum 1 can be selected or maximum all 6 can be selected..
so suppose 2 are selected then we should go to first options page after submitting that page ,then we should go to second options page..
i.e. one by one it should go to pages as per selected in listboxes..
Hope this time i am clear..
Thanx..

Reply
Reply
Not the answer you were looking for? Post your question . . .
189,938 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
Top ASP Forum Contributors