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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Variable to Text Box

Status
Not open for further replies.

dburnham

Programmer
Oct 18, 2001
118
US
I am passing a variable from one form to another(I think).

I need to find out how to place this variable in a text box on the second form.

Thank You in Advance.
David Burnham
 
Are the two forms on the same page, or on another page?
 

[tt]
Example forms:

Code:
[b]Form 1 Named [u]MyForm[/u]:[/b]
<form name="[u]MyForm[/u]" [COLOR=blue][b]action="Page_Receiving_MyForm.asp"[/b][/color]
method="post">
Username: 
<input type="text" name="YourName">
<input type="submit" value="Submit">
</form>


Code:
[b]Page 2 [u]Page_Receiving_MyForm.asp[/u]:[/b]
<html>
The name you typed in the form was = Request.form("YourName")
[/tt]


[tt]
As you can see, the form's field name "YourName" is then called on page two from the form.

[/tt]
 
Thank you both!

The forms are on two different pages. My issue deepens. The variable that I am passing or atleast I think I am are originating from a Database Result.

When I use the following I receive no errors but also no information is displayed from the variables.

<%
company = Request.Form("CoTblCompany")
copassword = Request.Form("CoTblPassword")
%>

company and copassword are both textbox names on my form.

Ultimately these variable are supposed to be put into another database table.

Any moe guidance that you or any one else can give is appreciated.

David Burnham
 
You can pass the value two ways, either as part of the query string or as a hidden form field.

Form field:
Code:
'inside the form
<input type="hidden" name="YourValue" value="<%=YourVariableHere%>">
and then you'd access it on the next page as:
Code:
Request.Form("YourValue")

Query string:
Code:
<form name="MyForm" action="Page2.asp?YourValue=<%=Server.URLEncode(YourVariableHere)%>"
method="post">
and then you'd access it on the next page as:
Code:
Request.Querystring("YourValue")
 
Just noticed that you want to put it in a textbox on the next page. Just in case it's not clear, on the next page your textbox would look like this:
Code:
<input type="text" name="newtextbox" value="<%=Request.Form("YourValue")%>">
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top