Results 1 to 5 of 5

Thread: Self Processing Forms...an the modify header error

  1. #1
    Join Date
    Jul 2013
    Posts
    41
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Self Processing Forms...an the modify header error

    Greetings, June 3rd 2014
    Briefly, I am utilizing "Self processing Php Forms" which I constructed a few years back and when I attempt to set a cookie I get the "Warning: Cannot modify header information - headers already sent by (output" would anyone by chance know of a way around it?...I assume that this will never be achieved since the page, header was initially loaded upon page load and the form processes cannot change the file header information. I repost information back to the form so reloading the page is out! I didn't set up sessions with the large form either?..Just looking for ideas?

    Appreciatively,
    Ted

  2. #2
    Join Date
    Jul 2010
    Location
    Minnesota
    Posts
    256
    Thanks
    1
    Thanked 21 Times in 21 Posts

    Default

    There are ways around it but the best way is to send the form data to a processing page that does not have any output on it. BUT it's impossible to give any guidance without seeing how your code looks.
    You never know everything, I learn everyday!

  3. #3
    Join Date
    Jul 2013
    Posts
    41
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Hey thanks for the reply! It is a very large file with several form handlers etc, much to large to expect anyone to analyze it...I have thought of processing the form data externally but I would have to just pass it back an repost to the form fields. I was looking for a quick fix....perhaps there isn't one?

    Appreciatively,

  4. #4
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    The "quick fix", although I risk having my hand slapped for making the suggestion and I know it shouldn't be relied upon because it gets you in to bad habits, is to try ob_start() at the top of your php. It's not the best practice - all the php code should come before any output (echos, prints or breakouts for HTML) but it can help make long convoluted scripts a little easier to deal with.

    http://stackoverflow.com/questions/4...b-start-in-php and https://www.google.com/search?q=ob_s...ercome+headers
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  5. #5
    Join Date
    Jul 2013
    Posts
    41
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Beverleyh, June 6th 2014

    Great! you directed me appropriately an I was able to correctly utilize the setcookie without invoking the "Header Error" However, while I was able to work around the php setcookie I still retained a javascript setcookie for purposes of a greeting should the url string not retain the correct passed greeting!...Great work! Thanks!

    Appreciatively,
    Ted

Similar Threads

  1. Warning: Cannot modify header information
    By jonnyfreak in forum PHP
    Replies: 3
    Last Post: 06-10-2013, 02:51 PM
  2. Replies: 3
    Last Post: 12-14-2011, 02:02 AM
  3. beginner error: forms not appearing
    By johnshanahan in forum PHP
    Replies: 1
    Last Post: 02-24-2011, 12:33 AM
  4. Replies: 6
    Last Post: 06-15-2009, 01:53 PM
  5. Replies: 6
    Last Post: 09-07-2007, 12:53 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •