Web Hosting Talk







View Full Version : Redirection...


CoryPippen
05-06-2004, 10:20 PM
You all have probably seen me posting in here quite a few times before... Well, I'm back asking questions again :stickout:

I have a form:

http://www.cpqservices.com/hosting/order.phps

wich posts to a file called "ordersend.php":

http://www.cpqservices.com/hosting/ordersend.phps

wich contains the code for mailing. I talked to a coder earlier about error checking and mailing, and he said it wasn't a good idea to mix php with javascript. Well, javascript handles the error checking quite nice, but php sent the mail...So, I moved the php mailing code to another file "ordersend.php". The mailing works out nice, but I need to be able to redirect the page "ordersend.php" to another called "order2.php"

http://www.cpqservices.com/hosting/order2.phps

without having a link. I tried using a redirect from the control panel, but the mailing didn't work. How would I redirect using php or javascript?

Apoch
05-06-2004, 10:44 PM
It sounds to me like you would be better off merging the two order pages. You can either do this by flattening the code into one file, or use include() / require() - the second is my preferred method. I would suggest creating a .php file that contains a function for emailing the script; include() or require() that page from the error checking page, and call the function to send the mail.

CoryPippen
05-06-2004, 11:10 PM
Originally posted by Apoch
It sounds to me like you would be better off merging the two order pages. You can either do this by flattening the code into one file, or use include() / require() - the second is my preferred method. I would suggest creating a .php file that contains a function for emailing the script; include() or require() that page from the error checking page, and call the function to send the mail.

Is there an english translation for this? :confused:

Apoch
05-07-2004, 12:40 AM
...what part doesn't make sense?

CoryPippen
05-07-2004, 06:13 PM
Originally posted by Apoch
...what part doesn't make sense?

The term "flattening" (some kind of php term?)

"include() / require ()" I have no idea what these do...

I understand creating a .php file with the emailing code, and I guess include() makes that possible...

...and call the function to send the mail.

? :confused: ?

UberTec
05-07-2004, 06:29 PM
flattening is not a php term. Apoch means to include the two files together to make one file

include and require do exactly this

http://www.php.net/include
http://www.php.net/require

CoryPippen
05-07-2004, 06:49 PM
How would I redirect the page using php?

UberTec
05-07-2004, 06:50 PM
header("Location: http://www.example.com/script.php");