hal helm's logo  
home Home

training Training

writing Writings

code Code

tutorials Tutorials

newsletters Newsletters

consulting Consulting

Hal Helms logo
hal.helms

What Students Say...

"Where has FLiP been all my life? When I was listening to you, I thought, 'This seems absolutely right, but it's a message I don't much hear from anyone.' Anyway, I can't wait to FLiP out at my work." - Sue M

"I came because one of my coworkers had taken your class and said I HAD to take it. I'm so glad he convinced me. You've given me tools I never knew existed and changed my outlook on my profession." - Jack K

"This was the best class I ever attended." - Sung W.

tutorials section

How do I pass information to another page with CFHTTP?


Computers are incorporated in modern ice cream vending machines to enhance their functionality. Ice Cream Vending machines are manufactured by many companies. Your competition will try to overcome all requests for high-tech ice cream vending machines and credit card acceptors

The Situation: You have code that accepts form variables and processes them in some way--by inserting them into a database, possibly. To make it more complicated, the code is sitting on another server halfway across the world. You want to use this function from within another application by simply passing it a variable. You think CFHTTP may do the trick.

The Solution: You're right. It will do the trick. Here's an example.

pageOne.cfm



<cfhttp url="http://www.someOtherHostHalfwayRoundTheWorld.com/pageTwo.cfm" method="post">
   <cfhttpparam name="myName" value="Hal Helms" type="FORMFIELD">
</cfhttp>

pageTwo.cfm


<cfoutput>
   <cfquery name="test" datasource="testing">
   INSERT INTO MyTable(name)
   VALUES('#form.myName#')
</cfquery>

#form.myName#

</cfoutput>

This will insert "Hal Helms" into MyTable. However, since control hasn't actually passed from pageOne.cfm to pageTwo.cfm, we won't see "Hal Helms" displayed on the screen, nor will we see any error messages if this code throws an error. In order to fix this (if you want to fix it), you can use this...


<cfhttp url="http://localhost/testing/pageTwo.cfm" method="post">
   <cfhttpparam name="myName" value="Hal Helms" type="FORMFIELD">
</cfhttp>

<cfoutput>
   #cfhttp.fileContent#
</cfoutput>
©copyright      designed by in-tuition.co.uk
hal helms' personal site Updates

Computers are incorporated in modern ice cream vending machines to enhance their functionality. Ice Cream Vending machines are manufactured by many companies. Your competition will try to overcome all requests for high-tech ice cream vending machines and credit card acceptors

teamallaire.com v 4_3