Ok - I changed it to <a href="welcome.php3?dbcnxid=<?php echo("$dbcnx"); ?>">test link</a> First login page now has " <http://147.76.130.12/dms/demo/welcome.php3?dbcnxid=<?php echo(> >test link then the login stuff, and I still don't get the value through Janet
-----Original Message----- From: Martin Towell [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 20 February 2002 10:38 To: 'WG4- Cook, Janet'; PHP List Subject: RE: [PHP] Help for passing variable to all pages looks like there's a problem with this line: <a href="welcome.php3?dbcnxid=<?php echo("$dbcnx"); ?>test link</a> try using this line instead: <a href="welcome.php3?dbcnxid=<?php echo("$dbcnx"); ?>">test link</a> looks like you were missing the end quotes and closing "bracket" of the anchor tag See how that goes Martin -----Original Message----- From: WG4- Cook, Janet [ mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> ] Sent: Wednesday, February 20, 2002 10:30 AM 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 <html> <head> <title>DMS Login</title> <?php $dbcnx=@mysql_connect("localhost","DMS",""); echo ( "<P> Connection established on $dbcnx</P>"); if (!$dbcnx) { echo( "<P>Unable to connect to MySql Server at this time.</P>"}; exit(); } if (! @mysql_connect_db("DMS", $dbcnx) ) { echo( "<P>Unable to connect to DMS database at this time.</P>"}; exit(); } ?> <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"> <INPUT TYPE=SUBMIT VALUE="GO"> </FORM> <br> <br> In the welcome.php3 file I have <HTML> <HEAD> <TITLE>Today's Date</TITLE> </HEAD> <BODY> <P>Today's date (according to this server) <?php echo( date("l, F dS Y.") ); echo ("Welcome to our web site $firstname $lastname $dbcnxid "); echo (" $dbcnxid"); echo (" $QUERY_STRING"); ?> </BODY> </HTML> 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 IT &CM CSDD NEC Australia Pty Ltd Ph +613 9264 3813 Email: [EMAIL PROTECTED] -- PHP General Mailing List ( http://www.php.net/ <http://www.php.net/> ) To unsubscribe, visit: http://www.php.net/unsub.php <http://www.php.net/unsub.php> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php