Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Redirect with added POST variables 1

Status
Not open for further replies.

nego78

Programmer
Jun 13, 2004
129
PL
Hi

I've got a form, user fill it and send it to my whatever.php

whatever.php parse it and if there aren't errors it should redirect user to anothwer site with new set of post variables.

Any suggestions ?

Webdesign
 
use the header command and put them in a session variable in key:value pairs...

otherwise to use the post method, you'd need to write a form with [hidden] elements and use a javascript redirect

Bastien

Cat, the other other white meat
 
Not sure this is the easiest way, but I wrote code which verified the data. If data is verified place into an array with field name as the index. If not my error flag was turn to true. At the bottom of the code, I check to see if the error flag was false. If so, redirect passing the array. Otherwise, displayed an error message and go back to the form.

I used the $_Get to retrieve the values from the array.

Hope this helps.
Meekos
 
thx for reply's

Bastien:
yes i thought about header
but i must exactly know how to do it.
I'm writing a shop code and this way i'll be redirecting to the paypal/ecard etc

schema:

client buy
client log in or is already logged
Client try go to order page
if he is logged he can / other way he is redir to login form

oki he request his order
by pressing form button with post

from this post i know that he would like to pay via paypal or another vendor
so in my script i must request data from my database, name client etc and send it via post to vendor page

oki let's try it

Code:
$ReqHeader =
"POST $URI HTTP/1.1\n".
"Host: $Host\n".
"Content-Type: application/x-[URL unfurl="true"]www-form-urlencoded\n".[/URL]
"$ReqBody\n";

$socket = fsockopen($Host, 80, $errno, $errstr);

fputs($socket, $ReqHeader);
etc...

will this be good ?

Webdesign
 
i would have just used

Code:
header("location:process.php?[data here]



Bastien

Cat, the other other white meat
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top