hobbit monitor
Results 1 to 8 of 8

Thread: Aide !

Threaded View

  1. #1
    Join Date
    Aug 2007
    Posts
    122

    Aide !

    Dear Aunt Fanny:




    Programming in PHP 5, I want to save all the settings from an input interface form in a cookie.

    It's an astronomy interface. It holds the date and time and other essential settings that can be used for computations by all the other programs on the site. Rather than have to reenter the same data repeatedly for a series of computations on different pages, I would prefer to save the settings in a common cookie, then all the programs that need the data can easily share it.

    However, I get errors that the headers have already been sent and the program malfunctions when I try to set a cookie from the interface form.



    What I need to do is:

    * ... On loading a page with an input interface, check to see if a cookie exists.

    2 ... If the cookie exists, reload the previous interface settings from it.

    * ... If not, then set the default values in the interface and them save them to a ***** cookie.

    4 ... When any change is made to the interface settings, the updated settings should be saved to a cookie when the [SUBMIT] button is clicked, which also re*****es the page.



    Simple trivial cookie examples from tutorial sites, like visit counters work OK.

    I just can't make it work for anything more useful, like storing and recalling the settings of an interface via a cookie.

    Grrrrr

    It works perfectly at home (IIS v5 web server).

    After sending the page to my web site host (UNIX Apache server), then it fails, telling me the headers have already been sent and the cookie never gets set and all the programs fail because the cookie data never got set.

    Reading the cookie is easy. Attempting to set the cookie gives the error, but only when I put the page on the Internet, not on my home server, where I develop, test and debug my work before posting it on the web.

    All the PHP code is prior to the start of any HTML code itself, which is what tutorials say is mandatory.

    This is my first serious attempt to use cookies in my PHP work and it is driving me bonkers!

    Any ideas ?


    .
    Last edited by JayT; 04-30-2008 at 11:58 PM.
    Oh to be free, so blissfully free, of the ravages of intelligence, there is no greater joy! - The Cweationist's Cweed

    All that is necessary for evil to triumph is a good PR firm.
    Very funny, Scotty. Now beam down my clothes!

Posting Permissions

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