470,604 Members | 2,184 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,604 developers. It's quick & easy.

changing a Form Variable

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?
Jul 19 '05 #1
3 2657
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" <Al**@noemail.com> wrote in message
news:O7*************@tk2msftngp13.phx.gbl...
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?

Jul 19 '05 #2
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!
Jul 19 '05 #3
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" <pa**@bullschmidt.com-nospam> wrote in message
news:u$**************@tk2msftngp13.phx.gbl...
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!

Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by BjoernJackschina | last post: by
3 posts views Thread by Emanuel Marciniak | last post: by
1 post views Thread by Young-Soo Roh | last post: by
8 posts views Thread by horos | last post: by
10 posts views Thread by Altman | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.