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!

posting variables in URL - noob question 2

Status
Not open for further replies.

Hondy

Technical User
Mar 3, 2003
864
GB
Hi

Whats the easiest way to populate a form with a variable passed from a URL?

Is there a way to so that a field called "affiliate" on a form can be prepopulated by a link? I see this is basic stuff but I wondered do you have to have the field as a variable within the code then or can you just make the text appear in the field some other way without changing the forms code?

Thanks!
 

If your user is clicking on a link on one page to take them to a form on another, and you then you wish to prepopulate a form field on the new page based on the page the user came from, you might be able to so it with http_referer.

Try this: (somebody will correct me if I have it wrong)

Code:
<title>Second Page</title>
<form action="some action">
Affiliate: <input type="text" name="affiliate" value=
<%
PreviousPage = Request.ServerVariables("HTTP_REFERER")
Response.Write PreviousPage
%>
style="width:400px;">
<input type="submit" value="Submit">
</form>

HTH.
 
ah i see, so you mean a webmaster who owns a domain, ok - that gives me an idea :)

Thanks!
 
this is the url that is written on the first page (link)
the link takes user to a new page called newpage.asp


strHTML = strHTML & "<td>" & "<a href=" & chr(34) & "newpage.asp?email=" & _
email & _
"&model=" & model & _
"&full_name=" & full_name & _
chr(34) & ">" & _
email & "</td>"

response.write strhtml




on the new page, this will get the items passed from the url string.


email = request.querystring("email")

model = request.querystring("model")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top