?
Solved

php - headers sent??

Posted on 2016-08-09
4
Medium Priority
?
46 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 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 84

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 9

Expert Comment

by:Mukesh Yadav
ID: 41749970
Try this ;)

Just remove closing PHP tags from save_to_session.php
0

Featured Post

Technology Partners: 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

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Suggested Courses

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