Jump to content

Recommended Posts

Hi,

Could someone tell me if it is possible to do this scenario?

 

Mike fills in a form on abc.com. He submits the form. The form is POSTED to 123.com.

123.com checks one field name in the $_POST array. 123.com then wants to POST the variables that were POSTED by abc.com to qwerty.com so that they can check the $_POST values.

 

Is that possible?

 

regards

Link to comment
https://forums.phpfreaks.com/topic/70562-solved-repost-_post/
Share on other sites

There might be an easier solution, but one way to do it would be to have the receiving page on abc.com to first do it's validation and then create a new form (with the target pointing to the receiving page of qwerty.com) with hidden fields named the same as in the original form, populated with the values, and then auto-submit the page as soon as it loads using javascript. At most the user would see a blank white page for about 1/2 second.

 

Example:

<?php

echo "<script type=\"text/javascript\">
  function submitForm() {
    if (document.formName) {
      document.formName.submit();
    }
  }
</script>";

echo "<body onload=\"submitForm()\";>";

if (!isset($_POST['submit'])) {
  echo "No form submited";
  exit;
}

//Perform validation here

echo "<form name=\"formName\" action=\"http://www.qwerty.com\" method=\"POST\">";
foreach ($_POST as $name => $value) {
  echo "<input type=\"hidden\" name=\"$name\" value=\"$value\">";
}
echo "</form>";



?>

Link to comment
https://forums.phpfreaks.com/topic/70562-solved-repost-_post/#findComment-354655
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.