cfhttpparam

Description

Required for a cfhttp POST operation. Specifies parameters to build the operation.

Category

Forms tags, Internet Protocol tags

Syntax

<cfhttpparam 
  name = "name"
  type = "type"
  value = "transaction type"
  file = "filename"> 

See also

cfftp, cfhttp, cfldap, cfmail, cfmailparam, cfpop

Attributes

Attribute Req/Opt Default Description
name
Required
 
Variable name for data that is passed
type
Required
 
Transaction type:
  • URL
  • FormField
  • Cookie
  • CGI
  • File
value
Optional if type = "File"
 
Value of URL, FormField, Cookie, File, or CGI variables that are passed.
file
Required if type = "File"
 
File name

Usage

This tag's parameter values are URL-encoded, so the values of special characters (such as the ampersand) are preserved when they are passed to the server. For more information, see the function URLEncodedFormat.

Example

<p>This view-only example shows the use of cfhttpparam to show the values 
of passed variables on another HTML reference, accessed by cfhttp. 
The other file could output the value of form.formtest, url.url_test,
cgi.cgi_test, and cookie.cookie_test to prove that this page is working:

<h3>Sample Other File Listing</h3>
<cfoutput>#HTMLCodeFormat("

<html>
<head>
<title>Sample Page</title>
</head>

<body>
<h3>Output the passed variables</h3>
<cfoutput>
  Form variable: ##form.form_test##
  <br>URL variable: ##URL.url_test##
  <br>Cookie variable: ##Cookie.cookie_test##
  <br>CGI variable: ##CGI.cgi_test##
</cfoutput>
</body>
</html>

")#</cfoutput>

<!--- <p>
<cfhttp 
    method = "post" url = "http://localhost/someotherfile.cfm">
  <cfhttpparam 
    name = "form_test" type = "FormField" value = "This is a form variable">
  <cfhttpparam 
    name = "url_test" type = "URL" value = "This is a URL variable">
  <cfhttpparam
    name = "cgi_test" type = "CGI" value = "This is a CGI variable">
  <cfhttpparam 
    name = "cookie_test" type = "Cookie" value = "This is a cookie">
</cfhttp>

<cfoutput>
    #cfhttp.fileContent#
</cfoutput> --->

Comments