Results 1 to 2 of 2
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    austin, Texas, USA
    Thanked 0 Times in 0 Posts

    Passing Data from a table to a submit statement

    in ASP I have a page that pulls data from a db and builds a table displaying the values. For a given staffing, there may be several recipients assigned to the staffing and I can get the system to go into the db, read out the staffing data and also build a table with the listed recipients. For everything on the Staffing part of the page you can change any data points displayed. The recipients table should also allow changes to be made. However, when I try and pass the data to the UPDATE page none of the recipient information goes.

    The table is built using Response.Write so there is a fair amount of quotes flying all over the place but I think my syntax is alright as there are no errors -- it just doesn't pass any data except for a few minor things.

    Here's the ASP code for a section of the total table:

    <font color=d2691e>mySQL = "Select RecipientAge, RecipientGender, RecipientEthnicity, RecipientInsurance FROM Recipients WHERE MonthlyID = " & MonthlyID & " AND StaffingCaseNumber = " & quote & StaffingCaseNumber & quote & ";"

    myRS.Open mySQL, DataConn, adOpenStatic, adCmdTable

    if not myRS.EOF then

    I = 1

    response.write "<table border=""1"" width=""600"">" & "<tr>" & _
    "<td width = ""25%"" align = ""center"">" & "Recipient Number" & "</td>" & _
    "<td width = ""25%"" align = ""center"">" & "Age" & "</td>" & _
    "<td width = ""25%"" align = ""center"">" & "Gender" & "</td>" & _
    "<td width = ""25%"" align = ""center"">" & "Ethnicity" & "</td>" & _
    "<td width = ""25%"" align = ""center"">" & "Insurance Status" & "</td>"& "</tr>"

    Do While NOT myRS.EOF

    Response.write "<tr><td>" & I & "</td>" & _
    "<td><input name=""RecipientAge"" size = ""1"" value=" & myRS.Fields("RecipientAge") & "></td>" & _
    "<td><select size = ""1"" name=""RecipientGender"">" & _
    "<option selected value=" & myRS.Fields("RecipientGender") & ">" & myRS.Fields("RecipientGender") & "</option>" & _
    "<option value = ""NoGenderSelected"">" & "No Gender Selected</option>" & _
    "<option value = ""Male"">" & "Male</option>" & _
    "<option value = ""Female"">" & "Female</option>" & _
    "<option value = ""Unknown"">" & "Unknown</option>" & _
    "</select></td>" & _
    </font color=d2691e>
    The logic is to open the table, find the matching recipient rows (if exist) and set up a loop to write out a table. On the UPDATE page I have the following (currently just trying to get the data to show up):

    <font color=d2691e>lngRow = Request.Form("lngRow")

    Response.Write lngRow & "<b r>"

    for X = 1 to lngRow
    Response.Write X & "<b r>"
    Response.Write Request.Form("MonthlyID") & "<b r>"
    Response.Write Request.Form("StaffingCaseNumber") & "<b r>"
    Response.Write Request.Form("RecipientAge" & X) & "<b r>"
    Response.Write Request.Form("RecipientGender" & X) & "<b r>"
    Response.Write Request.Form("Ethnicity" & X) & "<b r>"
    Response.Write Request.Form("InsuranceStatus" & X) & "<b r><hr>"
    </font color=d2691e>

    I get a printout of X which is a counter from 1 to lngRow (a variable storing the number of Recipients to be effected), Monthly ID and Staffing Case number (which are passed as hidden fields) but none of the rest show, even tho I have defined them as input fields and the table displays with the db table information. I have been working on this all day and am getting nauseous. Anybody have an inspiration as to why the data for form field doesn't pass to the next page?


    <font color=448800>I think I have figured out the cause -- long day...</font color=448800>

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Silicon Valley, USA
    Thanked 94 Times in 90 Posts

    Re: Passing Data from a table to a submit statement

    Steve, if you view source in the browser for the page with all the fields, do your fields all end up having the same names? I don't see the corresponding X value in your Response.Write code following Do While NOT myRS.EOF. (Maybe ASP claims to be able to handle same-named fields as an array, but I'm skeptical and would give them all different names.)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts