Forum Moderators: coopster

Message Too Old, No Replies

how to auto redirect a form

Form action problem

         

Kelmadics

3:07 pm on Jan 17, 2006 (gmt 0)

10+ Year Member



Here is my problem, I have a form that passes a value(ex. amount/price, name) to a php processing script, which is a different page like action=formprocess1.php. Now my problem is I want to redirect my fields to another processing page (example action=formprocess2.asp) without the user clicking the submit button again and without the user knowing it. So from form1.php to formprocess1.php to formprocess2.php without the user clicking the submit button in formprocess1.php. You might have gotten with this trouble before where you want two action to process your form fields but there is only one action you can declare to the form. Is there a way to this?

if you may wonder. i have a created a form that submits to a processing page, that shoots email and my client has its own credit card processing which resides in a different domain and i want to send the fields that i have extracted from my form to that credit card processing domain which resides in another server.

StupidScript

5:53 pm on Jan 17, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to the forums.

On the first processing page, do the processing but do not output anything. For example, go ahead and dump the data into the database and send your mail, but don't 'print()' or 'echo' or 'header()' anything until you are done with your end of the process.

Once your stuff is finished, add:

$nexturl="process2.php?formvar1=".$formvar1;

header("Location: $nexturl");

exit;

Build the next location into a variable and use the 'header()' function to send it there.

Note that any output at all, including blank lines in the script, before the 'header()' function will break it.

As far as redirecting info to another domain and keeping the visitor on your site at the same time, I'm not sure about that. Maybe output buffering can be used? Or you could use Javascript to popup a window with the outside redirect instructions passed via the popup URI to handle the card processing from the final page in your site's handling sequence?