Computing.Net > Forums > Web Development > Simple PHP Question

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Simple PHP Question

Reply to Message Icon

Name: ShaqDiesel
Date: May 17, 2008 at 18:34:04 Pacific
OS: winXP
CPU/Ram: Amd64/1Gb
Product: custom
Comment:

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?



Sponsored Link
Ads by Google

Response Number 1
Name: smbotans
Date: May 17, 2008 at 19:58:18 Pacific
Reply:

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

Mental Workout

Target the right Keywords

FREE SEO Report


0

Response Number 2
Name: ShaqDiesel
Date: May 17, 2008 at 20:08:41 Pacific
Reply:

because I actually want to LEARN something.


0

Response Number 3
Name: Laler
Date: May 18, 2008 at 07:47:56 Pacific
Reply:

> 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


0

Response Number 4
Name: Michael J (by mjdamato)
Date: May 20, 2008 at 09:48:42 Pacific
Reply:

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.php

You 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


0

Response Number 5
Name: ShaqDiesel
Date: May 21, 2008 at 21:08:19 Pacific
Reply:

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.


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

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


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: Simple PHP Question

Simple PHP Question www.computing.net/answers/webdevel/simple-php-question/2630.html

easy php question www.computing.net/answers/webdevel/easy-php-question/549.html

Simple PHP Note Area www.computing.net/answers/webdevel/simple-php-note-area/2980.html