Solved

php - headers sent??

Posted on 2016-08-09
4
31 Views
Last Modified: 2016-08-14
I get this:

Warning: Cannot modify header information - headers already sent by (output started at /home/rkassoc/public_html/Houston/save_to_session.php:65) in /home/rkassoc/public_html/Houston/post_form.php on line 76

Attached is post_form.php & save_to_session.php

How does it think line 65 of save_to_session.php (the closing php tag) is sending a header?

How do I fix?

Thanks
post_form.php
save_to_session.php
0
Comment
Question by:Richard Korts
4 Comments
 
LVL 108

Accepted Solution

by:
Ray Paseur earned 500 total points
Comment Utility
This has been a common problem for many years, so much so, that we have articles here at E-E explaining it and showing how to get past the issues!
https://www.experts-exchange.com/articles/4423/Warning-Cannot-modify-header-information-headers-already-sent.html

Using the "close PHP"  tag is a well-known antipractice (see #14).  Don't do that any more!

TL;DR: Learn about ob_start().
0
 

Author Comment

by:Richard Korts
Comment Utility
Ray,

I actually thought about you and your comment (on some other question) about the closing php tag.

I'll try it tomorrow. I'm about 98% sure that will do it.

Richard
0
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
And turn on 'error_reporting' in 'post_form.php'.  Always.  And 'save_to_session.php' is saving a lot of &_POST data to $_SESSION variables without doing any checking.  If one of the indexes for the &_POST data is missing, it will cause an error by sending an error message to the browser before your 'header' statements at the end of 'post_form.php'.
0
 
LVL 6

Expert Comment

by:Mukesh Yadav
Comment Utility
Try this ;)

Just remove closing PHP tags from save_to_session.php
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now