Re: How to load another php page?

From: Date: Sat, 02 Oct 2004 19:36:03 +0000
Subject: Re: How to load another php page?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-198505@lists.php.net to get a copy of this message
I created another php page with html and php code in it. What i want is exact what is done in an form action when a new php file is loaded, but without letting the customer pushing a button. Include works for including php code with functions and the header() function works if it is the first output sent in the script (otherwise you get errors like: Warning: Cannot modify header information - headers already sent by (output started at D:\Inetpub\wwwroot\xxxxxx.php:5) in D:\Inetpub\wwwroot\xxxxxx.php on line 31 But what i want is to load another php/html script and stop the running script. I guess it should be done with the header() function but then i have to put the test rigth in the beginning of the script? Arnold "Alex Hogan" <hogana@gmail.com> wrote in message news:4b7a4285041002101341164f7c@mail.gmail.com... > [snip] > How can i load another php file ("another.php") directly without an action > (example: clicking on a button)? > [/snip] > > If you're looking to check a condition and then add another php file > to your existing page then; > > if(isset($var1)) { > include ('another.php'); > or > include_once('another.php'); > } > is what you're looking for. > > If you're looking to redirect to another file based on a condition then; > > if(isset($var)){ > header('Location: another.php'); > } > > will work. > > > alex hogan

« previous php.general (#198505) next »