Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Advanced Techniques / September 2007



Tip: Looking for answers? Try searching our database.

CGI variables and CFOUTPUT

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
xcoldnet - 05 Sep 2007 01:06 GMT
I have this code which show me what CGI variables exists, however I wish to
show also the content of the CGI vrialbe if exist but I don't know how "to
tell" the CF server that in the second CFOUTPUT I wish to display the value of
the CGI variables instead of the text "CGI.whatever", I am sure the trick is
some function, the question is.... which one?

<cfloop index = "ListElement" list =
"ALL_HTTP,AUTH_TYPE,CONTENT_LENGTH,CONTENT_TYPE,GATEWAY_INTERFACE,HTTP_ACCEPT,HT
TP_HOST,HTTP_REFERER,HTTP_USER_AGENT,PATH_INFO,PATH_TRANSLATED,QUERY_STRING,REMO
TE_ADDR,REMOTE_HOST,REMOTE_IDENT,REMOTE_USER,REQUEST_BODY,REQUEST_METHOD,SCRIPT_
NAME,SERVER_NAME,SERVER_PORT,SERVER_PROTOCOL,SERVER_SOFTWARE">

<cfif cgi.ListElement IS NOT "">
<cfoutput>CGI.#ListElement#</cfoutput> variable exists: value
<cfoutput>CGI.#ListElement#</cfoutput> <br /><br />
<cfelse>
<cfoutput>CGI.#ListElement#</cfoutput> variable does not exist<br /><br />
</cfif>

</cfloop>
cf_dev2 - 05 Sep 2007 01:49 GMT
CGI is a structure.  You can use use array notation to get the value  
#CGI[elementName]#

<cfoutput>
<cfloop index = "ListElement" list =
"ALL_HTTP,AUTH_TYPE,CONTENT_LENGTH,CONTENT_TYPE,GATEWAY_INTERFACE,HTTP_ACCEPT,HT
TP_HOST,HTTP_REFERER,HTTP_USER_AGENT,PATH_INFO,PATH_TRANSLATED,QUERY_STRING,REMO
TE_ADDR,REMOTE_HOST,REMOTE_IDENT,REMOTE_USER,REQUEST_BODY,REQUEST_METHOD,SCRIPT_
NAME,SERVER_NAME,SERVER_PORT,SERVER_PROTOCOL,SERVER_SOFTWARE">
   <cfif CGI[listElement] is NOT "">
         CGI.#listElement# variable exists: value #CGI[listElement]# <br />
   <cfelse>
         CGI.#ListElement#  variable does not exist<br />
   </cfif>
</cfloop>
</cfoutput>
GArlington - 05 Sep 2007 16:59 GMT
> I have this code which show me what CGI variables exists, however I wish to
> show also the content of the CGI vrialbe if exist but I don't know how "to
[quoted text clipped - 16 lines]
>
>  </cfloop>

<cfloop item="elem" collection="#cgi#">
<cfotput>#elem# = #cgi[elem]#</cfoutput>
</cfloop>
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.