Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I set a variable to the value of a textbox control in a form??

Status
Not open for further replies.

Burls

Programmer
Mar 2, 2002
1
CA
What I have is a value I'm getting from a querystring that is a number. To format the number to be an integer instead of a string, I have put it in a textbox in a form. I now want to store the value from the textbox to a variable that I can pass to a cookie.

This is all nice and well except the following code doesn't work: (keep in mind I'm using VBScript as my ASP language)

<form name=&quot;myForm&quot;>
<input name=&quot;totD&quot; type=&quot;button&quot; value=&quot;&quot;></input>
</form>
<%
dim newTotD
newTotD = document.forms(0).elements(&quot;totD&quot;).value
Response.Cookies(&quot;total&quot;) = newTotD
Response.Cookies(&quot;total&quot;).Expires = DATE + 365
%>

Any help would be appreciated. Thanks.

Ryan
 
You're trying to mix client side and server side code. This cannot be done in this manner.

Check out this FAQ for some examples on how you might go about accomplishing this:

faq329-603

:)
paul
penny1.gif
penny1.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top