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!

passing variables via links

Status
Not open for further replies.

cherphas

Programmer
Jun 5, 2002
24
CA
Is there a way to pass variables via links? Like:

<A href=&quot;page1.cfm?number=#queryName.Number#&quot;>Link 1</a>

to pass it is no problem, but how do I retreive it in the next page?

#queryName.Number# would be a number taken from a database, when the user clicks on the link, the next page load up, and it get all the the rows in databse where number = =#queryName.Number#.

 
You can use the URL parameter &quot;number&quot; in the next page as the following:

<CFQUERY datasource=&quot;myDSN&quot; name=&quot;myQ&quot;>
SELECT * FROM myTable
WHERE number = #URL.number#
</CFQUERY>
 
In your example:
Code:
  <a href=&quot;page1.cfm?number=#queryName.Number#&quot;>Link 1</a>
When the user clicked on the link, you could access the value of the variable using the URL scope:
Code:
  <cfoutput>#URL.number#</cfoutput>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top