Post form to external URL; redirect to local page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • LeslieTP
    New Member
    • Jun 2007
    • 2

    Post form to external URL; redirect to local page

    I'd like to submit a .php form to a url at an external site and redirect to a local
    page, but am stumped and need some help.

    [code=html]
    <form ACTION="http://www.externalsit e/post.php" method="post" name="thisForm" onsubmit="retur n validate(this)" ></form>
    [/code]

    [Please use CODE tags when posting source code. Thanks! --pbmods]

    Have tried adding a hidden input type but it doesn't seem to be working.

    [code=html]
    <input type="hidden" name="redirect" value="http://www. mysite.com/thanks.html" />
    [/code]

    Thanks, LeslieTP
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, LeslieTP. Welcome to TSDN!

    The external script has to do the redirection. If you don't have control over it, you'll have to get in contact with the developer for that site.

    Comment

    • LeslieTP
      New Member
      • Jun 2007
      • 2

      #3
      Thanks! I'll be sure to use Code tags for my next post. I appreciate your prompt reply. So basically I need to contact the developer for the external site, and have them do the redirect for me back to my site? Thank you.

      Comment

      • ronnil
        Recognized Expert New Member
        • Jun 2007
        • 134

        #4
        Originally posted by pbmods
        Heya, LeslieTP. Welcome to TSDN!

        The external script has to do the redirection. If you don't have control over it, you'll have to get in contact with the developer for that site.
        hmmm

        wouldn't it be possible to POST the form via httpRequest and then redirect to the local page once that is done?

        or does httpRequest not support accessing other domains like flash?

        ofcourse this rules out any information printed by the external site...

        Comment

        • pbmods
          Recognized Expert Expert
          • Apr 2007
          • 5821

          #5
          Originally posted by ronnil
          wouldn't it be possible to POST the form via httpRequest and then redirect to the local page once that is done?
          To prevent XSS, most browsers will disallow cross-domain AJAX requests. However, you could create a PHP script that sends the POST request to another site and then redirects the browser.

          In general, though, if the external script can do it for you, it makes your life a lot easier.

          Comment

          • Motoma
            Recognized Expert Specialist
            • Jan 2007
            • 3236

            #6
            You could always perform your post in an invisible iframe, and have your main page do the redirect.

            Comment

            • ronnil
              Recognized Expert New Member
              • Jun 2007
              • 134

              #7
              pbmods >> yea, thought that too :)

              I think Motoma's solution sounds quite simple, and do-able....

              Comment

              Working...