problem to post data

Discussion in 'ASP General' started by vinodkus@gmail.com, Apr 18, 2007.

  1. Guest

    HV TAKEN A DRON DOWN AND FETCH RECORD OF THREE COLUMN FROM A TABLE,
    AND I HAVE TAKEN A SUBMIT BUTTON.JUST I WANT TO SHOW ALL RECORD IN
    NEXT PAGE JUST SPLIT THEM AND STORIN IN AN ARRAY BUT IT GIVES AN
    ERROR

    IT HAS TWO PAGES

    FIRST PAGE check1.asp

    <!--#include file="../../INCLUDES/SSPHARMASOFTCON.INC"-->
    <html>

    <head>
    <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <meta http-equiv="Content-Type" content="text/html;
    charset=windows-1252">
    <title>New Page 1</title>
    </head>
    <body>
    <form name = form1 action = "check2.asp" method = post>
    <select name = "drp1">
    <%
    set rs = Con.Execute("select
    EXECODE,EXEFNAME,EXELNAME,EXEAREA,EXEDESIGCODE from SS_EXEDETAIL where
    EXESTATUS='Y' AND EXECODE<>'SS-001' AND EXEDESIGCODE<>'MR' order by
    EXECODE")
    if not rs.eof then
    while not rs.eof
    %>
    <option value = <%=rs(0)%>;<%=rs(1)%>;<%=rs(2)%>><%=rs(0)%>:<
    %=rs(1)%>:<%=rs(2)%></option>
    <%
    rs.movenext
    wend
    end if
    %>
    <input type = submit value = submit name = submit>
    </body>
    </html>

    SECOND PAGE check2.asp

    <html>

    <head>
    <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <meta http-equiv="Content-Type" content="text/html;
    charset=windows-1252">
    <title>New Page 1</title>
    </head>

    <body>
    <%
    drp = Request.Form("drp1")
    'Response.write(drp)
    x = split(drp,";")
    response.write(x(0))
    response.write(x(1))
    response.write(x(2))

    %>

    </body>

    </html>

    Error Type:
    Microsoft VBScript runtime (0x800A0009)
    Subscript out of range: '[number: 1]'
    /sspharmasoft/softadmin/MISREPORTS/check2.asp, line 16
     
    , Apr 18, 2007
    #1
    1. Advertising

  2. wrote on 17 Apr 2007 22:15:04 -0700:

    > HV TAKEN A DRON DOWN AND FETCH RECORD OF THREE COLUMN FROM A TABLE,
    > AND I HAVE TAKEN A SUBMIT BUTTON.JUST I WANT TO SHOW ALL RECORD IN
    > NEXT PAGE JUST SPLIT THEM AND STORIN IN AN ARRAY BUT IT GIVES AN
    > ERROR
    >
    > IT HAS TWO PAGES
    >
    > FIRST PAGE check1.asp
    >
    > <!--#include file="../../INCLUDES/SSPHARMASOFTCON.INC"-->
    > <html>
    >
    > <head>
    > <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
    > <meta name="ProgId" content="FrontPage.Editor.Document">
    > <meta http-equiv="Content-Type" content="text/html;
    > charset=windows-1252">
    > <title>New Page 1</title>
    > </head>
    > <body>
    > <form name = form1 action = "check2.asp" method = post>
    > <select name = "drp1">
    > <%
    > set rs = Con.Execute("select
    > EXECODE,EXEFNAME,EXELNAME,EXEAREA,EXEDESIGCODE from SS_EXEDETAIL where
    > EXESTATUS='Y' AND EXECODE<>'SS-001' AND EXEDESIGCODE<>'MR' order by
    > EXECODE")
    > if not rs.eof then
    > while not rs.eof
    > %>
    > <option value = <%=rs(0)%>;<%=rs(1)%>;<%=rs(2)%>><%=rs(0)%>:<
    > %=rs(1)%>:<%=rs(2)%></option>


    Where are the quotes around the value? Try this:

    <option value = "<%=Server.HTMLEncode(rs(0) & ";" & rs(1) & ";" &
    rs(2))%>"><%=Server.HTMLEncode(rs(0) & ":" & rs(1) & ":" & rs(2))%></option>

    This way any spaces in the data don't split up the value, and any HTML
    characters are encoded to prevent breaking the HTML.

    > <%
    > rs.movenext
    > wend
    > end if
    > %>
    > <input type = submit value = submit name = submit>
    > </body>
    > </html>
    >
    > SECOND PAGE check2.asp
    >
    > <html>
    >
    > <head>
    > <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
    > <meta name="ProgId" content="FrontPage.Editor.Document">
    > <meta http-equiv="Content-Type" content="text/html;
    > charset=windows-1252">
    > <title>New Page 1</title>
    > </head>
    >
    > <body>
    > <%
    > drp = Request.Form("drp1")
    > 'Response.write(drp)
    > x = split(drp,";")


    At this point you should be checking that the array is the correct size
    before trying to print out the data, eg.

    If IsArray(x) Then
    If UBound(x) = 2 Then
    response.write(x(0))
    response.write(x(1))
    response.write(x(2))
    End If
    End If

    > %>
    >
    > </body>
    >
    > </html>
    >
    > Error Type:
    > Microsoft VBScript runtime (0x800A0009)
    > Subscript out of range: '[number: 1]'
    > /sspharmasoft/softadmin/MISREPORTS/check2.asp, line 16


    This error suggest that there are no semicolons in the drp1 value, probably
    because there is a space in the first value which due to you not putting
    quotes around the value in the OPTION element resulted in only the first
    part of the data being passed back to check2.asp.

    Dan
     
    Daniel Crichton, Apr 18, 2007
    #2
    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. Vishal
    Replies:
    1
    Views:
    673
    Steve C. Orr [MVP, MCSD]
    Dec 21, 2004
  2. =?Utf-8?B?Z29yaWxsYQ==?=
    Replies:
    1
    Views:
    772
    Masudur
    May 25, 2007
  3. Hal Vaughan
    Replies:
    4
    Views:
    782
    Hal Vaughan
    Jan 14, 2008
  4. JT

    post data, then post again..

    JT, Sep 5, 2003, in forum: ASP General
    Replies:
    1
    Views:
    142
    Bite My Bubbles
    Sep 6, 2003
  5. J. Muenchbourg
    Replies:
    0
    Views:
    365
    J. Muenchbourg
    Aug 6, 2003
Loading...

Share This Page