How to associate the value of dropdown with checkbox

Discussion in 'ASP General' started by Mamun, Jul 23, 2003.

  1. Mamun

    Mamun Guest

    Hi All,

    I have the following case.

    I am trying to update a table based on the value of dropdown box and
    checkbox.

    Here is what I have in page1.asp

    <table>

    <tr>
    <td>STATUS</td>
    <td>Claim Number</td>
    <td>Select</td>
    </tr>

    <form name=form action='Page2.asp' method='post'>
    <%dim I : I=1
    do while not rs.EOF%>

    <tr>
    <td>
    <select name="selStatus">
    <option value="A" selected>A</option>
    <option value='P'>P</option>
    <option value='D'>D</option>
    </select>
    </td>

    <td><%=rs("Claim_Number")%></td>
    <td><input type='checkbox' name='chk<%=i%>'
    value='<%=rs("Claim_Number")%>'></td>
    </tr>

    <%rs.MoveNext
    I = I + 1
    Loop
    %>

    <tr align='center' bgcolor='white'>
    <td><input type="submit" value="Submit" name="cmdSubmit">
    <input type='hidden' name='No_of_Records' value='<%=I%>'>
    </td>
    </tr>
    </form>

    </table>





    Now in page2.asp, I need to update data based on which checkbox was
    checked and what was selected in the STATUS field
    which is A, P and D.


    I have the following code in page2.asp:

    if Len(Request.Form("cmdSubmit"))>0 then

    dim JJ
    dim No_Of_Records, strClaimID, strStatusCD
    No_Of_Records=Request.Form("No_of_Records")

    For JJ=0 to No_Of_Records-1
    if Request.Form("chk" & JJ)<>"" then
    strClaimID=Request.Form("chk" & JJ)


    qry="Update warx065_srs set VENSTATCDE='" & strStatusCD & "' where
    ClaimNumber='" & strClaimID & "'"

    Conn.Execute(qry)
    end if
    Next
    end if


    The code in page2.asp selects the right claim Number but not the right
    status.

    For ex. if I check 2 checkboxes and run the query I get the following:

    Update table1 set VENSTATCDE='A, A, D, A, A, A, A, A, A, A, A, A, A,
    A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A,
    A, A, A, A, A, A, A, A, A, A, A, A, A, A' where ClaimNumber='K90611'
    Update table1 set VENSTATCDE='A, A, D, A, A, A, A, A, A, A, A, A, A,
    A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A,
    A, A, A, A, A, A, A, A, A, A, A, A, A, A' where ClaimNumber='K93632'


    I have 50 records in each page.


    How can I associate the value of dropdown with checkbox in this case.

    I would highly appreciate your help.

    Thanks a lmillion in advance.

    best regards,

    mamun
     
    Mamun, Jul 23, 2003
    #1
    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. Angel
    Replies:
    2
    Views:
    594
    Kikoz
    Dec 26, 2003
  2. Dailan
    Replies:
    0
    Views:
    469
    Dailan
    Jun 16, 2004
  3. vishnu
    Replies:
    1
    Views:
    1,217
    Patrick.O.Ige
    Mar 25, 2006
  4. Imran Aziz

    checkbox value attribute in checkbox control ?

    Imran Aziz, Aug 6, 2005, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    231
    Imran Aziz
    Aug 8, 2005
  5. randy
    Replies:
    13
    Views:
    456
    Tad McClellan
    Nov 1, 2003
Loading...

Share This Page