Dynamically POSTing Forms

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
BackMan
Forum Newbie
Posts: 1
Joined: Mon Feb 17, 2003 2:09 am
Location: UT, US
Contact:

Dynamically POSTing Forms

Post by BackMan »

This is a little complicated, so please bear with me. What I'm attempting to do is pass information via POST from a form on one domain to a form on a different domain, dynamically. In other words, the user does not click a "Submit" button to initiate it. Because of URL verification on the second site, passing variables via GET (in the URL line) will not work in my particular situation. It must be POSTed. Also, given the fact that the information is being passed between two domains, I can't save the info to a session.

I've seen a couple of examples on the PHP site and elsewhere, using fsockopen(), that illustrate how to POST variables to a URL, wait for a response, and then continue the original script. Is there a way to POST the information to the second site and remain at the second site as if a Submit button had been clicked? Is it possible to do this with a header() or some other command?

ANY help or suggestions would be appreciated.
The logic for Page 1 follows:

Code: Select all

<?
if ($Submit) &#123;
  // VERIFY SUBMITTED INFORMATION
  if (!$var1) &#123;$error = "var1 is required";&#125;
  if (!$var2) &#123;$error = "var2 is required";&#125;
  else &#123;
    // POST THE VERIFIED VARIABLES TO FORM 2
  &#125;
&#125;

?>
<!--HTML FOR PAGE CONTAINING FORM WHICH SUBMITS BACK TO ITSELF-->
Post Reply