473,388 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Warning Messages Using Session Control

I added session control to my survey application. I want to retain the
person's name entered on the 1st page and use it as a variable value on
subsequent pages.

I added on the first script:

<?
session_start();
Sep 15 '05 #1
2 1364
Once output has been sent to the browser headers cannot be sent.
Sending headers is how cookies are set (like session cookies), so you
get the errors described.

Somewhere in your script before session_start() you're sending output
to the browser. In fact, the error message even tells you the file and
line number where the output was sent (although in your post you cut
that part out).

Check the code listed in the error message. Even sending a single
blank space counts. You can ensure that no output is sent before
calling session_start() by using ob_start() and ob_flush() -- although
the correct solution is to probably rearrange your script so
session_start() gets called earlier on.

Sep 15 '05 #2
bobkaku wrote:

I added on the first script:

<?
session_start();
.
.
.
session_register($MyVar);


Don't use session_register - reference a mamber of the $_SESSION array
directly e.g.

print $_SESSION['MyVar'];

Otherwise your code will only work if register_globals is on (nothing to do
with the error messages you were getting - see Zeldor's response)

C.
Sep 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: patel | last post by:
Hello, I get this warning with my PHP code sometimes. It will come up, and then after reloading the page once or twice, it will go away. Any ideas? The code is below: Warning: Unknown: Your...
11
by: Dave | last post by:
I have this sample HTML code: <html> <head> <script type="text/javascript"> var WinHttpReq = new ActiveXObject("WinHttp.WinHttpRequest.5.1"); </script> </head>
8
by: Harry Simpson | last post by:
Got a web app that keeps the 20 sec session timeout default. Only deal is the user doesn't know the session timed out till they submit the page. On one page that i actually don't care if it times...
3
by: Chuck Cobb | last post by:
I'm doing a CSharp project in VS2005 and I'm getting some strange warning messages. The problem is that the warning messages don't link to anything in my code so they are very difficult to track...
19
by: lawrence k | last post by:
How can I find out where my script is outputting to the screen for the first time? My error logs are full of stuff like this: PHP Warning: session_start(): Cannot send session cache...
26
by: BillE | last post by:
Some ASP.NET applications use Session Variables extensively to maintain state. These should be re-written to use viewstate, hidden fields, querystring, etc. instead. This is because if a user...
4
by: lucavilla | last post by:
If you go to http://europe.nokia.com/A4305060, fill the "Enter your product code:" field with the value "0523183" and press "Go" (the ending page URL varies because there's a variable session-ID in...
1
by: CodeSeeker | last post by:
I have an application, which uses pop3 to read the messages from the mailbox, and it has been working fine for so many year. We recently have started changing this application to use java mail IMAP 4...
5
by: lisles | last post by:
i have a page funtion.php which hs the function to connect to the db /* Mysql Connection */ function connect(){ global $db_server,$db_user,$db_pass,$db;//Global Values from the config.php...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.