Thanks for the suggestion but it made no difference!

I am still getting nothing through

I think its something to do with the "test link" bit - what actually should
go in here - how does it relate this to all links?


-----Original Message-----
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 21 February 2002 2:04
To: 'WG4- Cook, Janet'; PHP List
Subject: RE: [PHP] Help for passing variable to all pages

<a href="welcome.php3?dbcnxid=<?php echo("$dbcnx"); ?>test link</a>

<a href=<?php print "\"welcome.php3?dbcnxid=$dbcnx\""; ?>>test link</a>

-----Original Message-----
From: WG4- Cook, Janet [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 19, 2002 5:30 PM
To: PHP List
Subject: [PHP] Help for passing variable to all pages

Hi All,

I am new to PHP and learning as I go by reading many of the tutorials
around.  I have however come up against a problem that I can't seem to solve
of find any other references to.

I need to make some information available to every page and one of the
series of articles by Kevin Yank which talks about PHP and MySql seemed to
suggest how to do exactly what I wanted but I can't get it to work. His
suggestion was to do something like

<A HREF="newpage.php?name=<?php echo($myvar); ?>" A link </A>

I think my problem is in the ...A LINK.. bit - what exactly should go here?

I tried some code to see if it worked and this is what I did:

in login.html

<title>DMS Login</title>
echo ( "<P> Connection established on $dbcnx</P>");
if (!$dbcnx) {
        echo( "<P>Unable to connect to MySql Server at this time.</P>"};
if (! @mysql_connect_db("DMS", $dbcnx) ) {
        echo( "<P>Unable to connect to DMS database at this time.</P>"};

<a href="welcome.php3?dbcnxid=<?php echo("$dbcnx"); ?>test link</a>

<FORM ACTION="welcome.php3" METHOD=GET>
First name: <INPUT TYPE=TEXT NAME="firstname"><BR>
Last Name: <INPUT TYPE=TEXT NAME="lastname">

In the welcome.php3 file I have 
<TITLE>Today's Date</TITLE>
<P>Today's date (according to this server)
        echo( date("l, F dS Y.") ); 
        echo ("Welcome to our web site $firstname $lastname $dbcnxid ");
        echo ("  $dbcnxid");
        echo (" $QUERY_STRING");

What I get is on login page - the text    test link    in blue (i.e. a
link?) and the login prompts.
On the welcome page I get the firstname and lastname ok, but the other
parameter is not in the $QUERY_STRING

Does anyone have any ideas as to what I am doing wrong?

Maybe there is a better way to have some information, that will be retrieved
from the DB available to all pages in the session.  We are not actually
going to have all the users with logins to the DB - but have our own
internal table of users, password and rights information, thus the userid
form this table needs to be available to all pages.

Many Thanks in advance for your help

Janet Cook
Software Engineer
NEC Australia Pty Ltd
Ph +613 9264 3813

PHP General Mailing List (
To unsubscribe, visit:

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to