> I am still having problems with variables not being
> remembered by included files. I've tried using the
> global command and it still doesn't work. I've cut
> down my two pages to contain the main stuff so you can
> see what's happening. Basically main.php includes the
> file new.php and I want the variable '$name' to be
> remembered in it. The other included files aren't
> important to the problem I'm having.
>
> main.php
> ===========
>
> <?php
> global $name;
> $name = 'home';
> ?>
> <html><head>
> <title>Tite</title>
> <link rel="stylesheet" type="text/css"
> href="stylesheet.css"/>
> </head>
> <body>
> <?php
>
> include("http://www.vocalwebsites.com/neilhowlett/new.php")
Use include("new.php"), not the full URL. The way you're doing it now, your
making a brand new request for the _result_ of a .php page. There is no
relation to this page and new.php when you request it in this manner. If you
just do include('new.php'), then it takes the _php_ code (the whole file)
from new.php and inserts it into this file and runs it. So then your
variables will still work.
also, take away the "global $name" calls, they don't do anything.
> ?>
> <hr>
> <?php
> include("http://www.vocalwebsites.com/footer.php");
Same thing here... You're getting the parsed _result_ of footer.php, not the
code.
---John Holmes...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php