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

code reuse

Status
Not open for further replies.

mickeyg

Technical User
Mar 30, 2001
120
US
I want to combine my two member profile screens instead of having a profileadd.cfm and profileupd.cfm.

I started down the path of looking at my Session.UserID to default in data during "modify" mode, but this will not work right if that person wants to "add" someone.

Should I just pass a parameter on the a href link? How do I parse this in Cold Fusion.

Thanks,
Mickey
 
Ahhh...I think I found what I need: #CGI.query_string
 
If you're trying to pass a parameter on an anchor link, something like:
Code:
   <a href=&quot;somepage.cfm?myparameter=myvalue&quot;>Click here</a>
then all you need to do is look in the URL scope in the receiving page.

In other words, for the link above, in somepage.cfm, you only need to look at the variable
Code:
#URL.myparameter#
... and it will contain the value that you passed (&quot;myvalue&quot;).

There can be as many parameters as you need (as long as the total length of the URL string doesn't exceed 255 characters, I think). So a link like:
Code:
   <a href=&quot;somepage.cfm?firstname=John&lastname=Smith&company=ACME&mode=view&quot;>Click here</a>
would pass URL variables to somepage.cfm such that:
Code:
  <CFIF CompareNoCase(URL.mode,&quot;view&quot;) EQ 0>
  <!--- display the values only if mode=view --->
  <CFOUTPUT>#URL.firstname#<br />
            #URL.lastname#<br />
            #URL.company#<br /></CFOUTPUT>
   </CFIF>
would output
Code:
     John
     Smith
     ACME

You can certainly look at
Code:
#CGI.query_string#
... but you'd have a lot of manual parsing to do. And since ColdFusion has already done all the parsing for you... you might as well make use of it.




-Carl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top