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>