View Full Version : Displaying variables problem
09-06-2009, 04:19 PM
I am having a problem displaying error message and other variables.
I am using the isset function to assess whether a variable has a value - if it does then the variable is displayed.
<h5>Your team number is: </h5> <?php echo $team_num;
When this variable has a value it is not being displayed. Is there a setting (maybe in the php.ini file) which stops this displaying?
The reason I think this maybe is the .ini file is that on one system I have the variable is being displayed but on another it is not.
This is driving me mad so any help would be great...
09-06-2009, 04:33 PM
For displaying error messages, please add to the top of your script:
If I have not understood your question correctly, could you explain a little bit more which is the problem please ...
Edit: as to php.ini, both seetings culd be done there too:
error_reporting = E_ALL
display_errors = On
But please do not use anything like that at the Production environment. At the Production environment all errors should be hidden from users. To completely disable standard PHP error output you could do the following:
09-06-2009, 07:10 PM
thanks for the reply SK..
The problem is that the variables such as the $_SESSION['SESS_TEAM_NUM'] variable below are not being displayed when they are populated with a value.
I have checked the temp session files and values are being created for these session variables but they are not being displayed when the isset function below is run...
I don't think this is a problem with the code so I was wondering if there is anything else that would stop them being displayed..
09-06-2009, 07:20 PM
It is a pleasure.
Do you have session_start() (http://us.php.net/manual/en/function.session-start.php) at the top of each page which uses sessions ?
If you populate the array $_SESSION at one page, which has session_start() at the top, but viewing it at the other page which does not have session_start() at the top, the session data at the 2nd page would not be available.
Please notice that session_start() sends HTTP header (sends a session cookie via an HTTP header to be exact), so it must be called before any output is sent to the browser.
09-06-2009, 07:27 PM
I had deleted session_start() from the top of the code when deleting something else...
never even thought of checking it so you've saved me from pulling my hair out..apologies for wasting your time on this..
thanks for the quick replies..
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.