Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Upon pressing a button my email script will be activated. After processing the data, I want to take the user to a thank you page that is in another directory(separate from htdocs) How do I do this?
I was using header() but I noticed it didnt like how my thank you page was in a separate directory. For the location I put the path to the thank you page that's on my hard drive. According to the header documentation it needs to be an http header so I guess the page must be in htdocs so that it'll work like http://localhost/thankYou.html.
How do I get around this?

i will answer your question differently
looking up natemail in google ... it is a free email processing form php script that has lots of excellent features
why reinvent the wheel :-)
serge

> Separate from htdocs
Do you mean, outside the web server's public folder? That can't be done.
PHP (and other processes in your web server) can read files from anywhere in the computer, even if it is outside the web server's public folder, assuming the web server has appropriate permission. But the web server's visitors, cannot.
If you mean another folder inside the htdocs, then what's wrong with including the correct path in the header() function?(There could be some problems, especially in windows, but I have no experience).
---
Fubar

I was using header() but I noticed it didnt like how my thank you page was in a separate directory. For the location I put the path to the thank you page that's on my hard drive.
No you would not use localhost. That would only work for the person viewing the page on the actual server machine. You can just put the actual domain name. If you don't have a domain name yet or need to have the code portable, you can extract the domain from the $_SERVER variable. Let's say this is your directory structure:
[htdocs]
|
|- emailprocessing.php
|- [subfolder]
|
|- thankyou.phpYou could refernce the thank you page like this (NOTE: replaced http with XXXX so it wouldn't be processed by the forum as a link):
<?php
header("Location: XXXX://{$_SERVER['HTTP_HOST']}/subfolder/thankyou.php");
?>Michael J

Thanks for your help guys, but I actually figured out that the problem was using backslashes instead of forward slashes for my "thankyou.php" path.
Thank you all for responding, especially Laler because I didn't know that my website's visitors wouldn't be able to access my pages unless they were located in some subdirectory of htdocs. I will keep this in mind when I get my site up live.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |