Solved

php - headers sent??

Posted on 2016-08-09
4
40 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 110

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 41749678
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
ID: 41749707
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 83

Expert Comment

by:Dave Baldwin
ID: 41749875
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 8

Expert Comment

by:Mukesh Yadav
ID: 41749970
Try this ;)

Just remove closing PHP tags from save_to_session.php
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
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 …
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

733 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