calling a .php file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
giles
Forum Commoner
Posts: 34
Joined: Thu Sep 14, 2006 2:34 pm

calling a .php file

Post by giles »

Hi all,

I’m working on my first PHP project – fill a form, email details to me, trigger a force download. All the main components work, just need to fit them together

I have a normal HTML page with a number of fields. Submit calls a .php page which checks the fields for user input, if >0 a email is dispatched to me. I have another .php page which starts a force download. Thing is how do I call this page from the end of the first script page?

It has to be after the Email check script, which means it’s in the body so I can’t use headders or page divert. A manual hyperlink (as a way of testing) works just fine, but how to I call a automatically call a URL? fopen() appears to open and READ the file, calling the page via echo”URL” also fails.

It can’t be that difficult can it?
Hope you can help

Many thanks
Giles
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

giles wrote:It has to be after the Email check script, which means it’s in the body so I can’t use headders or page divert. A manual hyperlink (as a way of testing) works just fine, but how to I call a automatically call a URL? fopen() appears to open and READ the file, calling the page via echo”URL” also fails.
In order to force a download, you need to send headers, so even if you load the script into the body, you're going to get a headers-already-sent error...

I would just link to the script and open it in a new window
jmut
Forum Regular
Posts: 945
Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:

Post by jmut »

no sure exactly what you want to do but.

including this file should work.

other than that you could you

Code: Select all

header("Location: file.php");
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I hate repeating myself.

If you are going to use header redirection, always, always, always use a FULL URL. To find out why, search.
Post Reply