1. the only other ways to pass things around would be in sessions, or by
setting a cookie on the user's computer... i hate the latter, and would
prefer the former, but would NEVER carry things like a MySQL uname and
password around in cookies or sessions.  cookies, sessions, and even post &
get (url) should be used for user-specific things (who are they, what are
they asking the server to do), not program-related things (like the database
password, or the global font size, or the site admin's email address... this
is generally done with a config file or other included file:

2. you could define your vars (like the MySQL uname and pword) in a config
file, and include it at the top of all your PHP scripts:

<? include('incdir/config.php'); ?>

3. you can extend this further, by setting a value php.ini (auto-prepend I
think) so that PHP will ALLWAYS includes the config file at the top of every


on 11/12/02 10:56 AM, Stefan Hoelzner ([EMAIL PROTECTED]) wrote:

> Hi folks,
> surely this question has already been answered many times before in this ng,
> but nevertheless: I want to pass variables  from
> one .php to another .php script. But I do not want to use either the
> http://localhost/target.php?var1=test&var2=test2 nor
> the
> POST method. I would like to pass over general variables like usernames and
> passwords for several MySQL-connects;  obviously
> it is not a good way to pass these vars via the mentioned ways.
> What else does PHP offer? Are there any other methods? Can I define these vars
> as some kind of "global variables" in any
> ini-file?
> THX for your support!
> Stefan.

Justin French
Web Development & 
Graphic Design

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

Reply via email to