Results 1 to 3 of 3

Thread: ASP Script problem

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 1999
    Location
    Belfast
    Posts
    254
    Hi,
    another question from me ( sorry two today ). I have a couple of questions, but will explain what I am trying to do first.

    I am trying to create a number of text boxes and populate them with the value from a field in a recordset I have returned from a query request.
    If the recordset field has a particular name I create a text box, if not I just print the value: code below:

    do while not records.eof
    for each fld in records.fields
    response.write "<TD align='center' >"
    if fld.name = "quantity" then response.write "<input type = 'text' size='5' name='quantity" & num & "' value = " & fld.value & ">"
    num = num + 1
    else
    response.write "<font face='Arial'>" & fld.value & "</font>"
    end if
    response.write "</TD>"
    next
    total = total + records("Total")
    response.write "<tr>"
    records.movenext
    loop
    response.write "<tr><td></td><td></td><td></td><td></td><td><b><font face='Arial'> Total Cost: " & (Total/100) & "p</font></b></td></tr>"
    response.write "</TABLE>"

    This creates the text boxes, with correct values in them.

    Now when a button is pressed I want to check the values in the text boxes, I use:

    if Request.Form("Update_Values") = "Update Basket Details" Then
    for i = 1 to num
    x = request.form("quantity" & num)
    response.write x
    next
    end if

    This doesn't work ( not really surprising ), but I would like to know how do I get the values from the text boxes, and have I created the text boxes properly, i.e. are they actually called "quantity1". "quantity2"..."quantityn"

    Sorry for convolution.

    Lenin.

    Any help appreciated.

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    Here goes!

    Your code actually looks pretty good.

    I think you need to request num again


    if Request("Update_Values") = "Update Basket Details"
    num = request("num")
    Then
    for i = 1 to num
    x = request("quantity" & i)
    response.write x
    next
    end if

    Mark
    -------------------

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Feb 1999
    Location
    Belfast
    Posts
    254
    Mark,
    thnaks for the reply, I will hjave a go and let you know.

    again thanks.

    Lenin

Posting Permissions

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



Click Here to Expand Forum to Full Width