Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Newbie needs help !

    Hi, I just started learning asp recently and I'm only able to do the most basic things....like write the contents of a form into a database and output the results onto another page. This is my problem:

    I am able write data from a form into a database on page#1. I am able to output the contents of that form on page#2. But I also need to output those contents into a hidden form on page#2.

    So I guess my question is: can you read data from a database into a form ? And if you can please tell me how!! Thanks!

  • #2
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    so you know how to get the data out off your database and puth them into a recordset.

    To insert this data into a form, just create your form, and replace the value's with the one from your recordset.

    example code

    <input id="text1" maxlength="50" name="name" size="40" type="text" value='<%response.write(rsClients.Fields("name"))%>'></td>

    As you can see, it's quite simple.

  • #3
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you, I'll try it and see if it works.

    I was trying a similar method but it didn't work. The output on
    page#2 uses lines like this:

    <%=FP_FieldVal(fp_rs,"name")%>

    But when I tried to put those lines in the form it didn't work:

    <input id="text1" maxlength="50" name="name" size="40" type="text" value='<%=FP_FieldVal(fp_rs,"name")%>'>

    Thanks again.

  • #4
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    no problem. (By the way, I use VBScript)

    below is some code to generate a listbox, based on the data in your recordset (one option for each record)

    do while rsClients.EOF=false
    ' comment : normale html code: <option value=12> test </option>
    Response.Write("<option value=" & rsSoort.Fields("clientID")& ">")
    Response.Write(server.HTMLEncode(rsSoort.Fields("name")) & "</option>")
    'server.htmlencode converts all text into html code
    rsSoort.MoveNext
    loop


    It's always the same principle. Just replace the values you would insert manuely, by a value from your recordset.


  •  

    Posting Permissions

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