changing a Form Variable

Discussion in 'ASP General' started by Alex, Nov 25, 2003.

  1. Alex

    Alex Guest

    This may sound like a simple question but I really dont' know how to do
    this.

    I know you can call a Form Variable in a VBscript using
    Request.Form("FieldName") and make equal a local variable like:

    str = Request.Form("FieldName")

    Now if do this:

    str = "This is the new value"

    How do you make FieldName equal str. So In a sense I want this to happen

    FieldName = str

    I need this so that when FieldName gets posted to the DB the new value get
    sent.

    Any ideas?
     
    Alex, Nov 25, 2003
    #1
    1. Advertisements

  2. Ray at

    Ray at Guest

    I'm not really sure why you'd want to do this, unless you're trying to
    dynamically create form field names, in which case, you'd do:

    <% sVar = "SomeFieldName %>
    <input name="<%=sVar%>" type="text">

    You cannot reassign the names of the form elements when the form is posted.
    The Request.Form collection is read-only.

    Ray at home

    "Alex" <> wrote in message
    news:...
    > This may sound like a simple question but I really dont' know how to do
    > this.
    >
    > I know you can call a Form Variable in a VBscript using
    > Request.Form("FieldName") and make equal a local variable like:
    >
    > str = Request.Form("FieldName")
    >
    > Now if do this:
    >
    > str = "This is the new value"
    >
    > How do you make FieldName equal str. So In a sense I want this to happen
    >
    > FieldName = str
    >
    > I need this so that when FieldName gets posted to the DB the new value get
    > sent.
    >
    > Any ideas?
    >
    >
     
    Ray at, Nov 25, 2003
    #2
    1. Advertisements

  3. Bullschmidt

    Bullschmidt Guest

    In the updating to the database:
    objRS("MyField") = str

    Best regards,
    J. Paul Schmidt, Freelance ASP Web Developer
    http://www.Bullschmidt.com
    ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Bullschmidt, Nov 25, 2003
    #3
  4. Tom B

    Tom B Guest

    If you open your database with the right kind of cursor, you can do the
    update.

    Do While not objRS.EOF
    objRS("MyField")="new value"
    objRS.MoveNext
    Loop
    objRS.Update

    I prefer to use an UPDATE Sql statement, to make the changes
    if objConn is my connection....

    Dim sSQL
    Dim newValue
    newValue="new value"
    sSQL="UPDATE tablename SET MyField='" & newValue & "' WHERE columnUniqueID=
    X"
    objConn.Execute sSQL


    In this way you aren't pulling down a recordset just so you can do an
    update.

    If you need to display the "updated" data, just do the UPDATE first.



    "Bullschmidt" <-nospam> wrote in message
    news:u$...
    > In the updating to the database:
    > objRS("MyField") = str
    >
    > Best regards,
    > J. Paul Schmidt, Freelance ASP Web Developer
    > http://www.Bullschmidt.com
    > ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
     
    Tom B, Nov 25, 2003
    #4
    1. Advertisements

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. Samridhi Kumar Shukla
    Replies:
    1
    Views:
    631
    Alvin Bruney
    Nov 30, 2003
  2. mfglinux
    Replies:
    11
    Views:
    937
    Roberto Bonvallet
    Sep 12, 2007
  3. Aaron Beall
    Replies:
    2
    Views:
    2,180
    Aaron Beall
    Sep 14, 2007
  4. David Filmer
    Replies:
    19
    Views:
    478
    Kevin Collins
    May 21, 2004
  5. Derek Basch
    Replies:
    8
    Views:
    244
    Ben Morrow
    Aug 12, 2006
Loading...

Share This Page