0

php header()

Hi

Header("Cache-control: private, no-cache");
Header("Expires: Mon, 26 Jun 1997 05:00:00 GMT");
Header("Pragma: no-cache");

why this function is not working...

by
2 Replies
  • From looking at the output, the reason header is having an issue is because of output prior to the calls (on the application side). It was my understanding (I'm sure one of the YAP folks will jump in here if this isn't the case) that th use of header was not currently supported.

    - Jon

    QUOTE (Pijush @ Mar 3 2009, 03:58 AM) <{POST_SNAPBACK}>
    Hi

    Header("Cache-control: private, no-cache");
    Header("Expires: Mon, 26 Jun 1997 05:00:00 GMT");
    Header("Pragma: no-cache");

    why this function is not working...
    0
  • QUOTE (Jon @ Mar 3 2009, 07:36 AM) <{POST_SNAPBACK}>
    From looking at the output, the reason header is having an issue is because of output prior to the calls (on the application side). It was my understanding (I'm sure one of the YAP folks will jump in here if this isn't the case) that th use of header was not currently supported.

    - Jon


    Jon is correct.
    0
  • Hi Jon

    That's fine....But how can I remove the cache? Suppose after form fill up data stores in database, BUT when user reload/refresh the page, then it also sends and stores in Database. I want to stop that.

    Pls help.............my whole project stoped for that...

    From
    Pijush :(- Jon
    0
  • What's the flow that you use for submitting data to your database? You should be able to do this without having the issue of submitting duplicate data. I'm guessing you have a form that submits to another page, then you don't want users to refresh that submit page correct? Here's what I do to accomplish this - it should provide the same functionality without having to forward the user to another page or needing to clear the cache.

    - Instead of creating a submit button for the form, create a normal button that has an onclick event to call a JavaScript function, something like:
    CODE
    <input type="button" onclick="runMyFunc();" value="Submit"></input>


    - When that function is called you can capture all of the form objects, then create an AJAX request using the OpenSocial gadgets.io.makeRequest method, like:
    CODE
    var postdata = "myVal1=1&myVal2=2";
    var url = "myFile.php?cache=" + Math.random();
    var params = {};
    params[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.POST;
    params[gadgets.io.RequestParameters.POST_DATA] = postdata;
    gadgets.io.makeRequest(encodeURI(url), function(response){
    if (response.text){ DO SOMETHING WITH THE RETURN DATA }
    }, params);

    The url is the script that you want to call in order to store the data in the database. The postdata variable will contain the form data that you want to POST. When the makeRequest function completes, you can check the return data to see if it succeeded, then display a message on the page saying that the form saved.

    That should give you the functionality you need without having to submit the form to another page. Alternately, you can just add an "ON DUPLICATE KEY" check to your SQL to prevent duplicate values (which you may may to do anyways just to prevent duplicate data in case of multiple submits of the same information).

    Jonathan LeBlanc
    Senior Software Engineer
    Yahoo! Developer Network

    QUOTE (Pijush @ Mar 18 2009, 01:45 AM) <{POST_SNAPBACK}>
    Hi Jon

    That's fine....But how can I remove the cache? Suppose after form fill up data stores in database, BUT when user reload/refresh the page, then it also sends and stores in Database. I want to stop that.

    Pls help.............my whole project stoped for that...

    From
    Pijush :(
    0
  • Recent Posts

    in YAP