submit form to other site... in background (or whatever)?
Moderator: General Moderators
submit form to other site... in background (or whatever)?
Ok, here's what I need to figure out how to do.
I need to be able to fill out a form that submits the data to one site, then redirects (or whatever) to another site.
In other words...
> I fill out form.
> I click submit.
> Data goes to foo.com/page.php
> I go to bar.com
This possible?
I need to be able to fill out a form that submits the data to one site, then redirects (or whatever) to another site.
In other words...
> I fill out form.
> I click submit.
> Data goes to foo.com/page.php
> I go to bar.com
This possible?
- partiallynothing
- Forum Commoner
- Posts: 61
- Joined: Fri Nov 21, 2003 5:02 pm
- Location: connecticut, usa
Try looking into the header function http://php.net/header
Here is an example:
Here is an example:
Code: Select all
<?php
// Process post data
header('Location: http://bar.com/'); // Redirect user
?>- harrisonad
- Forum Contributor
- Posts: 288
- Joined: Fri Oct 15, 2004 4:58 am
- Location: Philippines
- Contact:
re
yourform.php submit to processing.php, then processing.php will redirect it to otherplace.php
dig it
dig it
ok, you guys still aren't getting what I mean... Ok, let me re-explain yet again.
I have control over page A. page B is NOT under my control in any way. the same for page C.
In other words, it might look like this:
me.com/form.php =>DATA=> foo.com/processing.php
\\=>REDIRECT=> bar.com/view.php
Again, I have no control over the page I want the data sent to. :/
I have control over page A. page B is NOT under my control in any way. the same for page C.
In other words, it might look like this:
me.com/form.php =>DATA=> foo.com/processing.php
\\=>REDIRECT=> bar.com/view.php
Again, I have no control over the page I want the data sent to. :/
-
jmrdeuce32
- Forum Newbie
- Posts: 15
- Joined: Wed Apr 27, 2005 5:45 pm
- Location: Naples, FL
Where is the data going in the page you are sending it to?...Does it know to look for the data?....Does the data change between the first and second pages?...
If the second page is accepting dat use variables like $_POST or $_GET depending on what the page is looking for.
I don't know how you would be redirected from the second page to the third if you don't have any control over the second.
You may be able to have the form open a new window with the second page as well as redirect to the third page in the main window.
If the second page is accepting dat use variables like $_POST or $_GET depending on what the page is looking for.
I don't know how you would be redirected from the second page to the third if you don't have any control over the second.
You may be able to have the form open a new window with the second page as well as redirect to the third page in the main window.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
set the action to the site you want it to go to. This can be dynamically changed with javascript.
You can always use curl()
You can always use curl()
ok, curl's giving me a headache. Does this look anything close to right?
Code: Select all
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://foo.com/process.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "var={$_GET['var']}");
curl_exec($ch);
curl_close($ch);just pop a new window and target the post to the new window
Code: Select all
<script language="e;Javascript"e;>
<!-- //
function popIt(){
window.open('','windowfoo','toolbar=0,menubar=0,scrollbars=0,resizable=0,width=1,height=1');
document.theform.target = 'windowfoo';
document.theform.submit();
}
// -->
</script>