Forum Moderators: coopster

Message Too Old, No Replies

PHP Form interace with two pages.

         

Menekali

1:14 am on Sep 10, 2004 (gmt 0)

10+ Year Member



Hey all, this place has always helped me with my php needs in the past. Now i have a problem.

Im working on a project for a ewb servicing company in san diego. And i have a form set up, that sends information to a server that we're doing buisness with. Now they have on their side (this is an asp page) that shows the information just submitted, but it is pretty ugly. Is there anyway (or any tricky method you can think of) that will have the form submit the information to the server (it uses the GET action), while sending the user to another page, so that i can format it the way i want it to look, while also outputting what they put in?

So i need it to send the information to the server, but also to another page, so i can make the page good looking. I tried a few small things, but it would only go to another page, and NOT forward the information to the second page. Could anyone PLEASE help me? Thanks alot in advance! Who ever helps me is a life saver. Thanks!

Menekali

1:19 am on Sep 10, 2004 (gmt 0)

10+ Year Member



Hm no way to edit posts im sorry for the double post. But is this idea possible?

Have it send the information (still using the "get" action, to a page that say, says "processing", and that next page sends the information to the server, and then also to another page and then directs its self to that other page? Oh man im confusing my self here hehe someone help AHHH!

IanKelley

2:43 am on Sep 10, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



First submit the form data to the external site by opening a socket and sending a POST request, then redirect the user to your custom confirmation page using:
header("Location: [example.com...]

[edited by: ergophobe at 3:00 pm (utc) on Sep. 10, 2004]
[edit reason] URL exemplified - no commercial URLs as per TOS [/edit]

Menekali

3:08 am on Sep 10, 2004 (gmt 0)

10+ Year Member



Im sorry if this a bit noobie, but i need a bit more clarification, and thank you very much for your help.

Im sort of confused about the socket but ill look into it. If the reads it correctly through a get method, will it read it correctly through a post as well? I thikn it might need the variables through the url but ill look into that after your next reply. Also where would i put that header information? I click on submit and then it sends the info, where does that header come into play?

Im sorry if im being terribly noobish, but i appreciate your patience!

IanKelley

5:10 am on Sep 10, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If it will accept a GET request then your job is a little easier... If the server you're on has http wrappers enabled (usually a default setting) then you can just use the fopen function to send the data.

Once that's done print the location header with any necessary variables in the url and the user will be taken there.

Make sure you don't print anything to the browser before this point.

mincklerstraat

7:51 am on Sep 10, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This doesn't really sound too difficult, no.
You have the form on the asp server, you want to send the result to the php server for processing, but you want the 'return' page with info etc. also to be on the same asp server, yes?

The form "action" should be set to the page that's on the php server, the php server will get all the info that's been input via the $_GET array - make sure it doesn't do any output - you can put an ob_start(); at the top of the php page to make sure - and then some script to build up the asp page url again it needs to be directed to, I guess with this same info -

$requeststring = '';
if(!empty($_GET)){
$i = 0;
foreach($_GET as $k=>$v){
if($i >0) $reqeststring .= '&';
$requeststring .= $k.'='.$v;
$i++;
}
}
header('Location: [aspserver...]

If you have problems, look up the php functions on magic_quotes_gpc() and stripslashes()

[edited by: ergophobe at 3:04 pm (utc) on Sep. 10, 2004]
[edit reason] url changed as per TOS [/edit]

Menekali

8:54 am on Sep 10, 2004 (gmt 0)

10+ Year Member



Thanks dude, ill try what you posted (that small piece of code) for sure, and see if it works. If not ill reply back after looking up that info. Thanks again bro.

Menekali

7:47 pm on Sep 10, 2004 (gmt 0)

10+ Year Member



weird even though its goign to the next page, it still forwards me to the asp page