Web Hosting Talk







View Full Version : PHP Help Needed ASAP


HostDigital
04-24-2002, 03:48 PM
I am having trouble with an order form I am creating. Can someone please try to help me out?

I am trying to get it to redirect to a payment url, after all informaton is submitted, and I am trying to do this in one script.

Here is what it is doing:

1.) Client Enters Their Info
2.) Client Clicks Submit
3.) Script Checks For Errors
if there is an error it will tell the client
otherwise it will continue on
4.) Sends Info To Us By Email
5.) Redirects to Payment Url

I have completed everything, but #5, I can not get it to work, how would I do this?

Thanks, you can contact me on AIM my username is DigitalHst

(SH)Saeed
04-24-2002, 04:13 PM
Put this after the error check but before(!!) any HTML has been sent to the user:

header("Location: https://secure.domain.com/dir/file.php?pay=yes");

Example... (nevermind the below code, it's just to to show that your PHP code has to come before the HTML in order for header() to work).

<?php
if(all fields are filled in correctly) {
header("Location: https://domain.com/dir/file.php?whatever");
} else {
showError();
}
?>
<html>
<head></head>
<body>Hello!</body>
</html>