Cannot send session cookie – headers already sent [duplicate]

Remove the session_start() from inside the for loop.

Put the session_commit() outside the for loop at the very end.

Both these functions should only be called once in a script.

Leave a Comment