RE: [PHP] Simple question
| From: | Lawrence dot Sheed at dfait-maeci dot gc dot ca | Date: | Thu, 28 Sep 2000 06:59:02 +0000 |
| Subject: | RE: [PHP] Simple question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-17868@lists.php.net to get a copy of this message | ||
Use the include function.
Eg
<?php
if ($exp==true) {
include "myhtml.html";
}
?>
If its a php script you can do the same thing eg
<?php
if ($exp==true) {
include "myscript.php";
}
?>
If you need to pass variables to the script, then declare those before the
include eg
<?php
if ($exp==true) {
$etc=1;
include "myscript.php";
}
?>
This is functionally the same as myscript.php?etc=1
Hope this helps.
Other associated functions to look at are
require - same as include, but script halts if file isn't found
include_once / require_once - only include the file once per script.
Useful if you define settings in a global file and want to include that in
all your scripts.
On the first occurence, it includes / requires the file in your code, on the
second include / require it doesn't include it because its already there.
So functions won't get redefined etc. (Ignore this if it sounds confusing!)
cheers,
Lawrence.
-----Original Message-----
From: Richard Vibert [mailto:richard@viberts.com.au]
Sent: September 28, 2000 12:34 PM
To: php-general@lists.php.net
Subject: [PHP] Simple question
I know this has to have a simple answer, but I cant find it ( I'm very new
to php)
How can I load a page from within php with out having to use a form and
submit button.
eg
<?
if (exp)
load "this page?etc"
?>
Any help would be much appreciated.
=======================================
Richard Vibert
richard@viberts.com.au
Tatura Mitre10
=======================================
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net