How to associate the value of dropdown with checkbox

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mamun

    How to associate the value of dropdown with checkbox

    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.a sp' 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("Clai m_Number")%></td>
    <td><input type='checkbox' name='chk<%=i%> '
    value='<%=rs("C laim_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_Rec ords' 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.For m("cmdSubmit")) >0 then

    dim JJ
    dim No_Of_Records, strClaimID, strStatusCD
    No_Of_Records=R equest.Form("No _of_Records")

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


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

    Conn.Execute(qr y)
    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='K9 0611'
    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='K9 3632'


    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
Working...