3 Replies Latest reply on Aug 24, 2006 8:34 AM by r0bbb

    cfhttp post to new page

    r0bbb Level 1
      Hi

      Im trying to use cfhttp to post some variables to a new page. I then want the new page to be displayed, so i am using redirect="yes", but it is not redirecting, just staying on the posting page. Here is the code i have in the posting page and the redirect page:

      post.cfm

      <cfhttp url="receive.cfm" method="post" redirect="yes">
      <cfhttpparam name="SessionID" value="#SessionID#" type="FormField">
      <cfhttpparam name="Amount" value="#Amount#" type="FormField">
      </cfhttp>

      receive.cfm:

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns=" http://www.w3.org/1999/xhtml">
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
      <title></title>
      </head>
      <body>
      <cfoutput>
      #Amount#
      </cfoutput>
      </body>
      </html>

      ive read somewhere that you need to return location in a header or something, but i cant find any examples or explanations. Does anyone know how this is done?

      Thanks

      Rob
        • 1. Re: cfhttp post to new page
          r0bbb Level 1
          Can anybody point me in any kind of direction? im having no luck.

          thanks

          Rob
          • 2. Re: cfhttp post to new page
            <newbie /> Level 1

            I made two changes to your code.

            Here's the new code with the two changes...

            <cfhttp url=" http://localhost/receive.cfm" method="post" redirect="yes">
            <cfhttpparam name="SessionID" value="#SessionID#" type="FormField">
            <cfhttpparam name="Amount" value="#Amount#" type="FormField">
            </cfhttp>

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

            Perhaps there was confusion about how the redirect attribute works?
            Or perhaps I miss-understood what you are trying to achieve.

            My interpretation of what you wanted was to allow the page doing the posting
            to be redirected vs allowing the page receiving the post to be redirected.

            I think the redirect attribute allows the page receiving the post to be redirected?


            Good luck!
            • 3. Re: cfhttp post to new page
              r0bbb Level 1
              Hi,

              Basically what i want to achieve is the same effect as when a normal form is posted.

              post.cfm would be the page with the form on, and receive.cfm would be the output page, displaying the variables sent from receive.cfm

              I cant simply display the contents of receive.cfm in post.cfm using cfhttp.fileContent, as receive.cfm is going to be on a secure server.