> -----Original Message-----
> From: Mark Smith [mailto:[EMAIL PROTECTED]
> Sent: 04 May 2007 08:23

> Hello all,
> Is there a way to allow the passing of variables to included scripts
> using the GET method, for example include"file.php?name=person"; or is
> there another method of including files that allow you to do this. I
> have attempted to do this without success, I just get a message saying
> the file cannot be found.
>

Hi Mark,

No, this isn't possible as it makes no sense. When you include a file, you
are not performing a request that generates a response - you are simply
including the contents of one file in another. When you call include, think
of it as just copy/pasting the contents of the included file at that point.

Any variables already defined (and in scope) will therefore be be available
to the code included file, for example:

--- main.php ---

$strTitle = 'The title';
$intTitleLength = strlen($strTitle);

include('display.php');


--- display.php ---

echo 'Title is '.$strTitle.' and is '.$intTitleLength.' characters long';


I hope this makes sense but feel free to reply to the list if you have any
questions.

Edward

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to