[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 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 DMS Login Connection established on $dbcnx"); if (!$dbcnx) { echo( "Unable to connect to MySql Server at this time."}; exit(); } if (! @mysql_connect_db("DMS", $dbcnx) ) { echo( "Unable to connect to DMS database at this time."}; exit(); } ?> test link First name: Last Name: In the welcome.php3 file I have Today's Date Today's date (according to this server) What I get is on login page - the texttest linkin 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/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Help for passing variable to all pages
Ok - I changed it to ">test link First login page now has " <http://147.76.130.12/dms/demo/welcome.php3?dbcnxid= >test linkthen 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: test link try using this line instead: ">test link 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 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 DMS Login Connection established on $dbcnx"); if (!$dbcnx) { echo( "Unable to connect to MySql Server at this time."}; exit(); } if (! @mysql_connect_db("DMS", $dbcnx) ) { echo( "Unable to connect to DMS database at this time."}; exit(); } ?> test link First name: Last Name: In the welcome.php3 file I have Today's Date Today's date (according to this server) What I get is on login page - the texttest linkin 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
RE: [PHP] Help for passing variable to all pages
That's not a lot of help - its a new installation, as far as I know everything has been done to default settings. What can I do to check the server setup Janet -Original Message- From: Martin Towell [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 20 February 2002 10:59 To: 'WG4- Cook, Janet'; PHP List Subject: RE: [PHP] Help for passing variable to all pages that makes me think that your page isn't being executed through php. why this is happening, i don't know - maybe a misconfigured web server Martin -Original Message- From: WG4- Cook, Janet [ mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> ] Sent: Wednesday, February 20, 2002 10:50 AM To: Martin Towell; PHP List Subject: RE: [PHP] Help for passing variable to all pages Ok - I changed it to ">test link First login page now has >test linkthen the login stuff, and I still don't get the value through Janet -Original Message- From: Martin Towell [ mailto:[EMAIL PROTECTED] <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: test link try using this line instead: ">test link 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]> < 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 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 DMS Login Connection established on $dbcnx"); if (!$dbcnx) { echo( "Unable to connect to MySql Server at this time."}; exit(); } if (! @mysql_connect_db("DMS", $dbcnx) ) { echo( "Unable to connect to DMS database at this time."}; exit(); } ?> test link First name: Last Name: In the welcome.php3 file I have Today's Date Today's date (according to this server) What I get is on login page - the texttest linkin 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/> < http://www.php.net/ <http://www.php.net/> > ) To unsubscribe, visit: http://www.php.net/unsub.php <http://www.php.net/unsub.php> < 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
RE: [PHP] Help for passing variable to all pages
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? Janet -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 change: test link to: >test link -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 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 DMS Login Connection established on $dbcnx"); if (!$dbcnx) { echo( "Unable to connect to MySql Server at this time."}; exit(); } if (! @mysql_connect_db("DMS", $dbcnx) ) { echo( "Unable to connect to DMS database at this time."}; exit(); } ?> test link First name: Last Name: In the welcome.php3 file I have Today's Date Today's date (according to this server) What I get is on login page - the texttest linkin 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/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Help for passing variable to all pages
Well I tried setting the variable to a constant value and it still didn't work. What I eventually want to pass is an ID retrieved from the DB that will be needed by every page Janet -Original Message- From: Simon Willison [mailto:[EMAIL PROTECTED]] Sent: Thursday, 21 February 2002 2:37 To: Rick Emery Cc: 'WG4- Cook, Janet'; PHP List Subject: Re: [PHP] Help for passing variable to all pages > > >test link > You can't pass resource types like database connection IDs in URLs as they are only relevant for the instance of the script in which they are created. The same goes for things like file identifiers (from fopen) and other stuff like that. Simon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help needed - need to access a value from DB into all pages
Hi there, I am struggling with a concept and can't seem to find a way to do it so hoping you all can help. We want to use PHP with MySql Db. For security reasons on the DB, it is to be accessed only through this front end i.e. via the internal web Each user will have a number of levels of access to various parts of the system, so the obvious design is one where there is only 1 real login to the MySQL db (i.e. the system will auto log everyone in as this without them knowing it), and then the user is validated against a table in my DB which holds the access rights. I can get through the login OK, and get my table to return "USERID" for this person. Now I need that "USERID" available to ALL other pages so I can use it to determine what parts of screens to show, and what to allow them to do. My question is how do I make this variable available to all pages?? Do I have to include it with the variables passed to each page or is there a simpler way of doing it. Can I put the variable in an include file and include it in every page - will that work?. Surely someone must have had a similar situation before and can tell me how they solved it. Many thanks Janet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help needed with Sessions
Hi all, I am trying to get sessions to work to use to pass some data around, but the values do not seem to be coming through - I've probably got something basic wrong PHP version is 4.0.4pl1 sources are validate.php Today's Date Connection established on $dbcnx"); if (!$dbcnx) { echo( "Unable to connect to MySql Server at this time."); exit(); } else { echo ("Connected to My Sql Server on connection $dbcnx."); }; if (! mysql_select_db("DMS", $dbcnx)) { echo( "Unable to connect to DMS database at this time."); exit(); } else { echo( "Established connection to DMS db"); }; $whoid=10; ?> testlink and in jtest.php I have The connection establishes, but the values do not appear to be there in the jtest page? Any ideas Thanks Janet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Basic help for radio buttons needed
Hi all, I am sure this is a very simple question, but after reading reams of doco I still can't find the answer. I am very new to PHP and HTML coding. I have a form (html) that uses radio buttons that goes to some PHP code - how in the PHP code can I tell which radio button was selected? My HTML code (which is inside another PHP page) is as follows Add new user Change User password Delete User Add new document I have tried various things in admin.php but nothing gives me which radio button was selected. TIA Janet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Basic help for radio buttons needed
Matt Thanks for the reference, but it still doesn't work for me. I now have Add new user Change User password Delete User Add new document and in admin.php "); echo (" submit = $submit "); echo ("select = $select "); $myval = $_POST['admin_do']; echo (" value is $myval "); echo (" admin_do is $admin_do "); echo $HTTP_POST_VARS['admin_do']; for ($i=0; $i <5; $i++) { echo (" counter = $i value is $admin[$i] "); }; ?> the only value I get is the $admin_do which has the value "Array" - not much help Any Ideas? Janet -Original Message- From: Matt [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 6 March 2002 11:00 To: WG4- Cook, Janet Subject: Re: [PHP] Basic help for radio buttons needed See http://www.php-faq.com/#66 - Original Message - From: "WG4- Cook, Janet" <[EMAIL PROTECTED]> To: "PHP List" <[EMAIL PROTECTED]> Sent: Tuesday, March 05, 2002 6:46 PM Subject: [PHP] Basic help for radio buttons needed > Hi all, > > I am sure this is a very simple question, but after reading reams of doco I > still can't find the answer. I am very new to PHP and HTML coding. > > I have a form (html) that uses radio buttons that goes to some PHP code - > how in the PHP code can I tell which radio button was selected? > > My HTML code (which is inside another PHP page) is as follows > > > Add new > user > Change > User password > Delete User > Add new > document > > > > > I have tried various things in admin.php but nothing gives me which radio > button was selected. > > TIA > > Janet > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Basic help for radio buttons needed
Thanks Matt, I've got it working now - there must be another admin_do[] somewhere - I changed it to adm_do and it worked! Thanks for your help Janet -Original Message- From: Matt [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 6 March 2002 11:41 To: WG4- Cook, Janet Cc: PHP List Subject: Re: [PHP] Basic help for radio buttons needed > the only value I get is the $admin_do which has the value "Array" - not much > help Running your code on my 4.1.2 box, I see: submit = select = value is Change User password admin_do is Change User password counter = 0 value is counter = 1 value is counter = 2 value is counter = 3 value is counter = 4 value is I recommend the you add phpinfo() to the admin.php script, and look at the variables at the bottom of the page. That will help you greatly. Also you could print_r($HTTP_POST_VARS) and see whats there. If you are getting an array, then you have something in the form you're not showing us, such as admin_do[]. If you have register_globals off, you can't use references to $submit, you must either use $_POST['submit'] or $HTTP_POST_VARS['submit'], where 'submit' is the field name in the form that you are interested in at the time. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Persistent Links help needed
Hi All, I have multiple PHP pages and make my connection to the MySQl db in one of these pages. When I go to the next one any mysql commands seem not to work - it look like the connection to the DB is lost! I have a feeling this is to do with persistent connections so here is the relevant parts of the phpinfo() output. My question is - what do I have to set and how do I do it so the connection remains or do I have to reconnect in every php file?? MySQL Support enabled Active Persistent Links 0 Active Links1 Client API version 3.23.33 MYSQL_INCLUDE MYSQL_LFLAGS MYSQL_LIBS Directive Local Value Master Value mysql.allow_persistent On On mysql.default_host no valueno value mysql.default_password no valueno value mysql.default_port no valueno value mysql.default_socketno valueno value mysql.default_user no valueno value mysql.max_links Unlimited Unlimited mysql.max_persistentUnlimited Unlimited Thanks Janet Cook -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php