PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?php
session_start();
print("Thank you so much for sending us your feedback.<br><br>");
print("<b>Name:</b> $name<br>");
print("<b>Email:</b> $email<br>");
print("<b>Comments:</b> $comments<br>");
print("<b>Contact Who:</b> $contact<br>");
print("<b>Phone:</b> $phone<br>");
?>
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at D:\users\gkwinspired.com\feedback.php:12) in D:\users\gkwinspired.com\feedback.php on line 83
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\users\gkwinspired.com\feedback.php:12) in D:\users\gkwinspired.com\feedback.php on line 83
Couple of things wrong with all of that. One, stop using session_register(). Assign your session vars to the $_SESSION superglobal array. Next, stop treating your sessions vars as though register_globals is on. Next, and most importantly in answering your question, make sure there is nothing at all sent to the browser before your call to session_start().
As an aside, this problem crops up about once a week. Did you search the forum before posting?
I want to place them all into an array as you said using the $_Session but how would that be accomplished? I just want to have one $_Session so this is what I have so far:
That is exactly what I am looking for....I am not too up with the syntax of PHP yet. I am now getting the following errors from the code though they are:
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at D:\users\gkwinspired.com\feedback.php:12) in D:\users\gkwinspired.com\feedback.php on line 83
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\users\gkwinspired.com\feedback.php:12) in D:\users\gkwinspired.com\feedback.php on line 83
Everah wrote:Next, and most importantly in answering your question, make sure there is nothing at all sent to the browser before your call to session_start().
gkwhitworth wrote:output started at D:\users\gkwinspired.com\feedback.php:12
Something at line 12 generates output. What is line 12?
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at D:\users\gkwinspired.com\feedback.php:4) in D:\users\gkwinspired.com\feedback.php on line 5
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\users\gkwinspired.com\feedback.php:4) in D:\users\gkwinspired.com\feedback.php on line 5
This is your problem. You sent the <head> tag to the browser before calling session start. You cannot send anything, not even a single white space, as output before your call to session_start() (or header() or setcookie()) as you will get this error message everytime.