Re: [PHP] After INSERT form submit - Data doesn't refresh!
Hello, I understand what you are trying to do. But as a web developer it is never a good practice to have a insert query and page to display the record in the same page. This way you will never add the redundant data whenever the page is refreshed. So from my experience I would suggest you do this: form.php if(isset($_GET['displayrecords']) && $_GET['displayrecords'] == "true") { show records }else{ HTML FORM submit } qry_form.php {INSERT QUERY} //redirect header('location:form.php?displayrecords=true') this intermediate step qry_form.php will insert the record and redirect to the same page with a get variable. This is a good practice to avoid inserting everytime you refresh the page. Thanks On Tue, Jul 22, 2008 at 8:12 AM, Daniel Brown <[EMAIL PROTECTED]> wrote: > On Tue, Jul 22, 2008 at 10:51 AM, Rahul S. Johari > <[EMAIL PROTECTED]> wrote: > > > > I just checked a couple of other browsers (IE, Safari, Opera) and it > seems > > to be working fine in all the browsers except Firefox 3. I think this > issue > > is now out of bounds for PHP - I don't think there is anything wrong in > the > > script or the way I'm doing this - I think the problem is lying somewhere > in > > either Firefox 3 or my settings of Firefox 3. Let me look into this. > > If you believe that to be the case, Rahul, please report your > findings at [EMAIL PROTECTED] We (I'm a Mozilla > developer as well) may then ask you to post portions of your > 'about:config' to better troubleshoot the issues. > > -- > > Better prices on dedicated servers: > Intel 2.4GHz/60GB/512MB/2TB $49.99/mo. > Intel 3.06GHz/80GB/1GB/2TB $59.99/mo. > Dedicated servers, VPS, and hosting from $2.50/mo. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
Re: [PHP] After INSERT form submit - Data doesn't refresh!
On Tue, Jul 22, 2008 at 10:51 AM, Rahul S. Johari <[EMAIL PROTECTED]> wrote: > > I just checked a couple of other browsers (IE, Safari, Opera) and it seems > to be working fine in all the browsers except Firefox 3. I think this issue > is now out of bounds for PHP - I don't think there is anything wrong in the > script or the way I'm doing this - I think the problem is lying somewhere in > either Firefox 3 or my settings of Firefox 3. Let me look into this. If you believe that to be the case, Rahul, please report your findings at [EMAIL PROTECTED] We (I'm a Mozilla developer as well) may then ask you to post portions of your 'about:config' to better troubleshoot the issues. -- Better prices on dedicated servers: Intel 2.4GHz/60GB/512MB/2TB $49.99/mo. Intel 3.06GHz/80GB/1GB/2TB $59.99/mo. Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] After INSERT form submit - Data doesn't refresh!
I just checked a couple of other browsers (IE, Safari, Opera) and it seems to be working fine in all the browsers except Firefox 3. I think this issue is now out of bounds for PHP - I don't think there is anything wrong in the script or the way I'm doing this - I think the problem is lying somewhere in either Firefox 3 or my settings of Firefox 3. Let me look into this. Thanks guys! On Jul 22, 2008, at 10:45 AM, Thijs Lensselink wrote: Quoting "Rahul S. Johari" <[EMAIL PROTECTED]>: No, actually the flow of the program does not work in that order. The flow of the program is in this order: My response was just to fast. Should have read all. At least the order is clear now :) - INSERT row function - INSERT HTML FORM - SELECT function to display records Technically the point at which the SELECT statement is executed and pulls records from the mySQL database - the newly inserted row is ALREADY there, so it really shouldn't have any problems displaying the new row. So if you do a print_r() on the result. It shows the updated record set? I know a couple of you are asking for the code, but quite honestly the codes are very, very simple INSERT, SELECT sql quries along with a simple HTML form. I don't think the actual SQL quries embedded in the page will really resolve the problem or help anyone in diagnosing this. I can post them - but I think like Thijs requested - the order would probably have been more important. Indeed the order is important. But a bit of code never hurts. Or a URL to check the output. The page begins with: somewhere after that is the HTML Form that the user can fill in somewhere after that So honestly I don't think it's this code that makes the difference. I still believe this is a browser cache issue. I could be wrong though. On Jul 22, 2008, at 9:08 AM, Thijs Lensselink wrote: Quoting "Rahul S. Johari" <[EMAIL PROTECTED]>: Here's what it is: I have a php page, "a.php", which contains these three things: - SELECT statement to display records from a mySQL Table - HTML Form for inserting data into the mySQL Table - INSERT statement to insert that row into the mySQL Table If the flow of you program really works in this order. Then i can understand you are looking at the same records after a INSERT. The SELECT query is run before the INSERT. So if you submit your INSERT form. The page first selects a record set from the database. And after that preforms the INSERT. The HTML Form submits to the same, "a.php" Once the user submits the Form, a.php is called which INSERT's the row into the mySQL Table. However, the row does not appear in the SELECT statement table data unless I hit refresh on the page. (The INSERT function is executed before the SELECT in the page). I used the header() code that was suggested: header('Cache-Control: no-cache, no-store, max-age=0, must- revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Pragma: no-cache'); $ffile = 'a.php'; $time = filemtime($ffile); header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT'); .. but it didn't help. Everything is working fine except that the Browser is more then likely caching the data and thus not allowing the newly inserted row to appear on top when the SELECT is executed. On Jul 22, 2008, at 8:34 AM, Thiago H. Pojda wrote: Code, please? :) On Tue, Jul 22, 2008 at 9:33 AM, Rahul S. Johari <[EMAIL PROTECTED] > wrote: Hmm, interesting. In my case, $file does indeed output dynamic data. I did try with the modified time but it still doesn't work. I still have to hit refresh on the browser, after submitting the form, in order for the inserted record to appear. Not sure what to do - it's rather annoying. Novice users of the page would assume the entry didn't get inserted or something happened. One alternate is to submit Data to a different page and let that page redirect to the Original page - but I do find it hard to believe that there is no solution to this caching. Thanks guys! On Jul 22, 2008, at 8:26 AM, Yeti wrote: The Last-Modified header tells the browser when the requested page was last modified. Now I don't know how you get the date in your case but here is an example: browser requests /test/test.php which is a simple php file without any includes etc. in this case $file = '/test/test.php'; This wont work if $file outputs dynamic data, so only use it if the content only changes when you change the file. Now if you are using templates etc. obtaining the Last- Modified time is a bit more complicated. If you use server side caching then you can chose the cached file else you have to figure it out yourself. And the RFC 2616 header specification says: An origin server MUST NOT send a Last-Modified date which is later than the server's time of message origination. In such cases, where t
Re: [PHP] After INSERT form submit - Data doesn't refresh!
Quoting "Rahul S. Johari" <[EMAIL PROTECTED]>: No, actually the flow of the program does not work in that order. The flow of the program is in this order: My response was just to fast. Should have read all. At least the order is clear now :) - INSERT row function - INSERT HTML FORM - SELECT function to display records Technically the point at which the SELECT statement is executed and pulls records from the mySQL database - the newly inserted row is ALREADY there, so it really shouldn't have any problems displaying the new row. So if you do a print_r() on the result. It shows the updated record set? I know a couple of you are asking for the code, but quite honestly the codes are very, very simple INSERT, SELECT sql quries along with a simple HTML form. I don't think the actual SQL quries embedded in the page will really resolve the problem or help anyone in diagnosing this. I can post them - but I think like Thijs requested - the order would probably have been more important. Indeed the order is important. But a bit of code never hurts. Or a URL to check the output. The page begins with: somewhere after that is the HTML Form that the user can fill in somewhere after that So honestly I don't think it's this code that makes the difference. I still believe this is a browser cache issue. I could be wrong though. On Jul 22, 2008, at 9:08 AM, Thijs Lensselink wrote: Quoting "Rahul S. Johari" <[EMAIL PROTECTED]>: Here's what it is: I have a php page, "a.php", which contains these three things: - SELECT statement to display records from a mySQL Table - HTML Form for inserting data into the mySQL Table - INSERT statement to insert that row into the mySQL Table If the flow of you program really works in this order. Then i can understand you are looking at the same records after a INSERT. The SELECT query is run before the INSERT. So if you submit your INSERT form. The page first selects a record set from the database. And after that preforms the INSERT. The HTML Form submits to the same, "a.php" Once the user submits the Form, a.php is called which INSERT's the row into the mySQL Table. However, the row does not appear in the SELECT statement table data unless I hit refresh on the page. (The INSERT function is executed before the SELECT in the page). I used the header() code that was suggested: header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Pragma: no-cache'); $ffile = 'a.php'; $time = filemtime($ffile); header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT'); .. but it didn't help. Everything is working fine except that the Browser is more then likely caching the data and thus not allowing the newly inserted row to appear on top when the SELECT is executed. On Jul 22, 2008, at 8:34 AM, Thiago H. Pojda wrote: Code, please? :) On Tue, Jul 22, 2008 at 9:33 AM, Rahul S. Johari <[EMAIL PROTECTED] > wrote: Hmm, interesting. In my case, $file does indeed output dynamic data. I did try with the modified time but it still doesn't work. I still have to hit refresh on the browser, after submitting the form, in order for the inserted record to appear. Not sure what to do - it's rather annoying. Novice users of the page would assume the entry didn't get inserted or something happened. One alternate is to submit Data to a different page and let that page redirect to the Original page - but I do find it hard to believe that there is no solution to this caching. Thanks guys! On Jul 22, 2008, at 8:26 AM, Yeti wrote: The Last-Modified header tells the browser when the requested page was last modified. Now I don't know how you get the date in your case but here is an example: browser requests /test/test.php which is a simple php file without any includes etc. in this case $file = '/test/test.php'; This wont work if $file outputs dynamic data, so only use it if the content only changes when you change the file. Now if you are using templates etc. obtaining the Last-Modified time is a bit more complicated. If you use server side caching then you can chose the cached file else you have to figure it out yourself. And the RFC 2616 header specification says: An origin server MUST NOT send a Last-Modified date which is later than the server's time of message origination. In such cases, where the resource's last modification would indicate some time in the future, the server MUST replace that date with the message origination date. So do not send a future date! On Tue, Jul 22, 2008 at 2:11 PM, Rahul S. Johari <[EMAIL PROTECTED] > wrote: I tried with just the first three header() statements you gave, but it didn't work. Let me try the modification date ... which file is being referred to in $ffile? Also, I'm using Firefox, if it's of any
Re: [PHP] After INSERT form submit - Data doesn't refresh!
Actually you do have a point. I didn't think about exit() I can surely use this, and the connection overhead is not of a major concern to me - definitely no more then displaying the newly inserted row - at the same time I would like *not* to abandon a search for an even better code if possible. Unless there doesn't exist any alternates, which still stumps me. Thanks! On Jul 22, 2008, at 10:37 AM, Andrew Ballard wrote: On Tue, Jul 22, 2008 at 10:24 AM, Rahul S. Johari <[EMAIL PROTECTED]> wrote: It works, but it's not the most efficient solution. The page has heavy graphics & text. Using the header("Location: a.php") loads the page in question twice. Slower connections will respond slowly to the page. No, it really doesn't. A redirect should be followed with an exit() to stop execution after the Location header is passed, so you don't need to send all the "heavy text" or the IMG tags to embed the images, and most client browsers will stop rendering the page as soon as they see this header and therefore won't request the "heavy images" in any event. Granted, there is still the connection overhead caused by an additional request. In theory, the header() statements for not using cache should have worked - I'm not sure why they are working. Even Googling the loading from cache problem gives those statements in various places. On Jul 22, 2008, at 10:16 AM, Jason Pruim wrote: Without seeing the code it's hard to tell.. But couldn't you just use a header("Location: a.php"); after the insert statement? Or is that too ugly of a hack? :) It works for me on a project I'm working on. (I hope this doesn't get lost in all the top posting on this thread.) Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] After INSERT form submit - Data doesn't refresh!
On Tue, Jul 22, 2008 at 10:24 AM, Rahul S. Johari <[EMAIL PROTECTED]> wrote: > > It works, but it's not the most efficient solution. The page has heavy > graphics & text. Using the header("Location: a.php") loads the page in > question twice. Slower connections will respond slowly to the page. No, it really doesn't. A redirect should be followed with an exit() to stop execution after the Location header is passed, so you don't need to send all the "heavy text" or the IMG tags to embed the images, and most client browsers will stop rendering the page as soon as they see this header and therefore won't request the "heavy images" in any event. Granted, there is still the connection overhead caused by an additional request. > > In theory, the header() statements for not using cache should have worked - > I'm not sure why they are working. Even Googling the loading from cache > problem gives those statements in various places. > > > On Jul 22, 2008, at 10:16 AM, Jason Pruim wrote: > >> Without seeing the code it's hard to tell.. But couldn't you just use a >> header("Location: a.php"); after the insert statement? Or is that too ugly >> of a hack? :) >> >> It works for me on a project I'm working on. >> >> (I hope this doesn't get lost in all the top posting on this thread.) Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] After INSERT form submit - Data doesn't refresh!
No, actually the flow of the program does not work in that order. The flow of the program is in this order: - INSERT row function - INSERT HTML FORM - SELECT function to display records Technically the point at which the SELECT statement is executed and pulls records from the mySQL database - the newly inserted row is ALREADY there, so it really shouldn't have any problems displaying the new row. I know a couple of you are asking for the code, but quite honestly the codes are very, very simple INSERT, SELECT sql quries along with a simple HTML form. I don't think the actual SQL quries embedded in the page will really resolve the problem or help anyone in diagnosing this. I can post them - but I think like Thijs requested - the order would probably have been more important. The page begins with: somewhere after that is the HTML Form that the user can fill in somewhere after that So honestly I don't think it's this code that makes the difference. I still believe this is a browser cache issue. I could be wrong though. On Jul 22, 2008, at 9:08 AM, Thijs Lensselink wrote: Quoting "Rahul S. Johari" <[EMAIL PROTECTED]>: Here's what it is: I have a php page, "a.php", which contains these three things: - SELECT statement to display records from a mySQL Table - HTML Form for inserting data into the mySQL Table - INSERT statement to insert that row into the mySQL Table If the flow of you program really works in this order. Then i can understand you are looking at the same records after a INSERT. The SELECT query is run before the INSERT. So if you submit your INSERT form. The page first selects a record set from the database. And after that preforms the INSERT. The HTML Form submits to the same, "a.php" Once the user submits the Form, a.php is called which INSERT's the row into the mySQL Table. However, the row does not appear in the SELECT statement table data unless I hit refresh on the page. (The INSERT function is executed before the SELECT in the page). I used the header() code that was suggested: header('Cache-Control: no-cache, no-store, max-age=0, must- revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Pragma: no-cache'); $ffile = 'a.php'; $time = filemtime($ffile); header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT'); .. but it didn't help. Everything is working fine except that the Browser is more then likely caching the data and thus not allowing the newly inserted row to appear on top when the SELECT is executed. On Jul 22, 2008, at 8:34 AM, Thiago H. Pojda wrote: Code, please? :) On Tue, Jul 22, 2008 at 9:33 AM, Rahul S. Johari <[EMAIL PROTECTED] > wrote: Hmm, interesting. In my case, $file does indeed output dynamic data. I did try with the modified time but it still doesn't work. I still have to hit refresh on the browser, after submitting the form, in order for the inserted record to appear. Not sure what to do - it's rather annoying. Novice users of the page would assume the entry didn't get inserted or something happened. One alternate is to submit Data to a different page and let that page redirect to the Original page - but I do find it hard to believe that there is no solution to this caching. Thanks guys! On Jul 22, 2008, at 8:26 AM, Yeti wrote: The Last-Modified header tells the browser when the requested page was last modified. Now I don't know how you get the date in your case but here is an example: browser requests /test/test.php which is a simple php file without any includes etc. in this case $file = '/test/test.php'; This wont work if $file outputs dynamic data, so only use it if the content only changes when you change the file. Now if you are using templates etc. obtaining the Last-Modified time is a bit more complicated. If you use server side caching then you can chose the cached file else you have to figure it out yourself. And the RFC 2616 header specification says: An origin server MUST NOT send a Last-Modified date which is later than the server's time of message origination. In such cases, where the resource's last modification would indicate some time in the future, the server MUST replace that date with the message origination date. So do not send a future date! On Tue, Jul 22, 2008 at 2:11 PM, Rahul S. Johari <[EMAIL PROTECTED] > wrote: I tried with just the first three header() statements you gave, but it didn't work. Let me try the modification date ... which file is being referred to in $ffile? Also, I'm using Firefox, if it's of any consequence. Thanks! On Jul 22, 2008, at 7:30 AM, Bernhard Kohl wrote: I'm pretty sure this is a cache issue .. To disable caching: header('Cache-Control: no-cache, no-store, max-age=0, must- revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Pragma: no-cac
Re: [PHP] After INSERT form submit - Data doesn't refresh!
On Tue, Jul 22, 2008 at 10:16 AM, Jason Pruim <[EMAIL PROTECTED]> wrote: > Without seeing the code it's hard to tell.. But couldn't you just use a > header("Location: a.php"); after the insert statement? Or is that too ugly > of a hack? :) > > It works for me on a project I'm working on. > > I wouldn't consider it a hack. I know some people on the list don't care for redirects, but I tend to use them this way to keep page functions in line with the semantics of GET (request data) and POST (modify state/data). Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] After INSERT form submit - Data doesn't refresh!
It works, but it's not the most efficient solution. The page has heavy graphics & text. Using the header("Location: a.php") loads the page in question twice. Slower connections will respond slowly to the page. In theory, the header() statements for not using cache should have worked - I'm not sure why they are working. Even Googling the loading from cache problem gives those statements in various places. On Jul 22, 2008, at 10:16 AM, Jason Pruim wrote: Without seeing the code it's hard to tell.. But couldn't you just use a header("Location: a.php"); after the insert statement? Or is that too ugly of a hack? :) It works for me on a project I'm working on. On Jul 22, 2008, at 9:42 AM, Daniel Brown wrote: On Tue, Jul 22, 2008 at 8:56 AM, Yeti <[EMAIL PROTECTED]> wrote: ok, in that case forget the Last-Modified or set it to the current date. header('Last-Modified: '.gmdate('D, d M Y H:i:s', time()).' GMT'); Expanding on this, keep in mind that some people may be as far ahead as GMT +1300. So if you want to use the Last-Modified HTTP/1.0 standard, you may want to try this: header("Last-Modified: ".gmdate("D, d M Y H:i:s",strtotime("+3 days"))." GMT"); ?> As for turning off caching in his own browser, while it may fix the OP's problem on his machine, it by no means fixes the bug in general. Other users will still be faced with the same issue. -- Better prices on dedicated servers: Intel 2.4GHz/60GB/512MB/2TB $49.99/mo. Intel 3.06GHz/80GB/1GB/2TB $59.99/mo. Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 11287 James St Holland, MI 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] After INSERT form submit - Data doesn't refresh!
Without seeing the code it's hard to tell.. But couldn't you just use a header("Location: a.php"); after the insert statement? Or is that too ugly of a hack? :) It works for me on a project I'm working on. On Jul 22, 2008, at 9:42 AM, Daniel Brown wrote: On Tue, Jul 22, 2008 at 8:56 AM, Yeti <[EMAIL PROTECTED]> wrote: ok, in that case forget the Last-Modified or set it to the current date. header('Last-Modified: '.gmdate('D, d M Y H:i:s', time()).' GMT'); Expanding on this, keep in mind that some people may be as far ahead as GMT +1300. So if you want to use the Last-Modified HTTP/1.0 standard, you may want to try this: header("Last-Modified: ".gmdate("D, d M Y H:i:s",strtotime("+3 days"))." GMT"); ?> As for turning off caching in his own browser, while it may fix the OP's problem on his machine, it by no means fixes the bug in general. Other users will still be faced with the same issue. -- Better prices on dedicated servers: Intel 2.4GHz/60GB/512MB/2TB $49.99/mo. Intel 3.06GHz/80GB/1GB/2TB $59.99/mo. Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 11287 James St Holland, MI 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] After INSERT form submit - Data doesn't refresh!
On Tue, Jul 22, 2008 at 8:56 AM, Yeti <[EMAIL PROTECTED]> wrote: > ok, in that case forget the Last-Modified or set it to the current date. > > > header('Last-Modified: '.gmdate('D, d M Y H:i:s', time()).' GMT'); Expanding on this, keep in mind that some people may be as far ahead as GMT +1300. So if you want to use the Last-Modified HTTP/1.0 standard, you may want to try this: As for turning off caching in his own browser, while it may fix the OP's problem on his machine, it by no means fixes the bug in general. Other users will still be faced with the same issue. -- Better prices on dedicated servers: Intel 2.4GHz/60GB/512MB/2TB $49.99/mo. Intel 3.06GHz/80GB/1GB/2TB $59.99/mo. Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] After INSERT form submit - Data doesn't refresh!
Quoting "Rahul S. Johari" <[EMAIL PROTECTED]>: Here's what it is: I have a php page, "a.php", which contains these three things: - SELECT statement to display records from a mySQL Table - HTML Form for inserting data into the mySQL Table - INSERT statement to insert that row into the mySQL Table The HTML Form submits to the same, "a.php" Once the user submits the Form, a.php is called which INSERT's the row into the mySQL Table. However, the row does not appear in the SELECT statement table data unless I hit refresh on the page. (The INSERT function is executed before the SELECT in the page). I used the header() code that was suggested: header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Pragma: no-cache'); $ffile = 'a.php'; $time = filemtime($ffile); header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT'); .. but it didn't help. Everything is working fine except that the Browser is more then likely caching the data and thus not allowing the newly inserted row to appear on top when the SELECT is executed. On Jul 22, 2008, at 8:34 AM, Thiago H. Pojda wrote: Code, please? :) On Tue, Jul 22, 2008 at 9:33 AM, Rahul S. Johari <[EMAIL PROTECTED] > wrote: Hmm, interesting. In my case, $file does indeed output dynamic data. I did try with the modified time but it still doesn't work. I still have to hit refresh on the browser, after submitting the form, in order for the inserted record to appear. Not sure what to do - it's rather annoying. Novice users of the page would assume the entry didn't get inserted or something happened. One alternate is to submit Data to a different page and let that page redirect to the Original page - but I do find it hard to believe that there is no solution to this caching. Thanks guys! On Jul 22, 2008, at 8:26 AM, Yeti wrote: The Last-Modified header tells the browser when the requested page was last modified. Now I don't know how you get the date in your case but here is an example: browser requests /test/test.php which is a simple php file without any includes etc. in this case $file = '/test/test.php'; This wont work if $file outputs dynamic data, so only use it if the content only changes when you change the file. Now if you are using templates etc. obtaining the Last-Modified time is a bit more complicated. If you use server side caching then you can chose the cached file else you have to figure it out yourself. And the RFC 2616 header specification says: An origin server MUST NOT send a Last-Modified date which is later than the server's time of message origination. In such cases, where the resource's last modification would indicate some time in the future, the server MUST replace that date with the message origination date. So do not send a future date! On Tue, Jul 22, 2008 at 2:11 PM, Rahul S. Johari <[EMAIL PROTECTED] > wrote: I tried with just the first three header() statements you gave, but it didn't work. Let me try the modification date ... which file is being referred to in $ffile? Also, I'm using Firefox, if it's of any consequence. Thanks! On Jul 22, 2008, at 7:30 AM, Bernhard Kohl wrote: I'm pretty sure this is a cache issue .. To disable caching: header('Cache-Control: no-cache, no-store, max-age=0, must- revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Pragma: no-cache'); But if you have the modification date then use $time = filemtime($ffile); header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT'); On Tue, Jul 22, 2008 at 1:14 PM, Rahul S. Johari <[EMAIL PROTECTED] > wrote: Ave, I'm wondering if there's a PHP solution to this, I could be in the wrong place. I have an INSERT form which submits to the same php page, which also displays the records from the mySQL database the INSERT form submits to. When the form submits and the page returns, the added record does not show up unless you "Refresh" the page. I'm imagining even after form submit, the Browser is caching the data and displaying data from the Cache. Is there a solution to this? Is there anything PHP can do to instruct the browser not the cache the data? Thanks! --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com -- Thiago Henrique Pojda --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTE
Re: [PHP] After INSERT form submit - Data doesn't refresh!
ok, in that case forget the Last-Modified or set it to the current date. header('Last-Modified: '.gmdate('D, d M Y H:i:s', time()).' GMT'); Did you turn caching off in your browser and try it then? Or try it with a different browser? On Tue, Jul 22, 2008 at 2:48 PM, Rahul S. Johari < [EMAIL PROTECTED]> wrote: > > Here's what it is: > > I have a php page, "a.php", which contains these three things: > > - SELECT statement to display records from a mySQL Table > - HTML Form for inserting data into the mySQL Table > - INSERT statement to insert that row into the mySQL Table > > The HTML Form submits to the same, "a.php" > Once the user submits the Form, a.php is called which INSERT's the row into > the mySQL Table. However, the row does not appear in the SELECT statement > table data unless I hit refresh on the page. (The INSERT function is > executed before the SELECT in the page). > > I used the header() code that was suggested: > > header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate'); > header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past > header('Pragma: no-cache'); > $ffile = 'a.php'; > $time = filemtime($ffile); > header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT'); > > .. but it didn't help. > > Everything is working fine except that the Browser is more then likely > caching the data and thus not allowing the newly inserted row to appear on > top when the SELECT is executed. > > > On Jul 22, 2008, at 8:34 AM, Thiago H. Pojda wrote: > > Code, please? :) >> >> On Tue, Jul 22, 2008 at 9:33 AM, Rahul S. Johari < >> [EMAIL PROTECTED]> wrote: >> >> Hmm, interesting. >> In my case, $file does indeed output dynamic data. >> >> I did try with the modified time but it still doesn't work. I still have >> to hit refresh on the browser, after submitting the form, in order for the >> inserted record to appear. >> >> Not sure what to do - it's rather annoying. Novice users of the page would >> assume the entry didn't get inserted or something happened. One alternate is >> to submit Data to a different page and let that page redirect to the >> Original page - but I do find it hard to believe that there is no solution >> to this caching. >> >> Thanks guys! >> >> >> On Jul 22, 2008, at 8:26 AM, Yeti wrote: >> >> The Last-Modified header tells the browser when the requested page was >> last modified. Now I don't know how you get the date in your case but here >> is an example: >> >> browser requests /test/test.php which is a simple php file without any >> includes etc. >> >> in this case >> >> $file = '/test/test.php'; >> >> This wont work if $file outputs dynamic data, so only use it if the >> content only changes when you change the file. >> >> Now if you are using templates etc. obtaining the Last-Modified time is a >> bit more complicated. If you use server side caching then you can chose the >> cached file else you have to figure it out yourself. >> >> And the RFC 2616 header specification says: >> >> An origin server MUST NOT send a Last-Modified date which is later than >> the server's time of message origination. In such cases, where the >> resource's last modification would indicate some time in the future, the >> server MUST replace that date with the message origination date. >> >> So do not send a future date! >> >> >> >> On Tue, Jul 22, 2008 at 2:11 PM, Rahul S. Johari < >> [EMAIL PROTECTED]> wrote: >> >> I tried with just the first three header() statements you gave, but it >> didn't work. >> Let me try the modification date ... which file is being referred to in >> $ffile? >> >> Also, I'm using Firefox, if it's of any consequence. >> >> Thanks! >> >> On Jul 22, 2008, at 7:30 AM, Bernhard Kohl wrote: >> >> I'm pretty sure this is a cache issue .. >> >> To disable caching: >> header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate'); >> header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past >> header('Pragma: no-cache'); >> >> But if you have the modification date then use >> $time = filemtime($ffile); >> header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT'); >> >> >> On Tue, Jul 22, 2008 at 1:14 PM, Rahul S. Johari < >> [EMAIL PROTECTED]> wrote: >> Ave, >> >> I'm wondering if there's a PHP solution to this, I could be in the wrong >> place. >> I have an INSERT form which submits to the same php page, which also >> displays the records from the mySQL database the INSERT form submits to. >> When the form submits and the page returns, the added record does not show >> up unless you "Refresh" the page. >> >> I'm imagining even after form submit, the Browser is caching the data and >> displaying data from the Cache. >> >> Is there a solution to this? Is there anything PHP can do to instruct the >> browser not the cache the data? >> >> Thanks! >> >> --- >> Rahul Sitaram Johari >> Founder, Internet Architects Group, Inc. >> >> [Email] [EMAIL PROTECTED] >> [Web] http://www.rahulsjohari.com >> >> >> >> >> >> -- >> PHP
Re: [PHP] After INSERT form submit - Data doesn't refresh!
On Tue, Jul 22, 2008 at 9:48 AM, Rahul S. Johari < [EMAIL PROTECTED]> wrote: > > Here's what it is: > > I have a php page, "a.php", which contains these three things: > > - SELECT statement to display records from a mySQL Table > - HTML Form for inserting data into the mySQL Table > - INSERT statement to insert that row into the mySQL Table > I understand that but I don't see any caching issue yet. That's why I asked for your code, can you provide an example? :) > > The HTML Form submits to the same, "a.php" > Once the user submits the Form, a.php is called which INSERT's the row into > the mySQL Table. However, the row does not appear in the SELECT statement > table data unless I hit refresh on the page. (The INSERT function is > executed before the SELECT in the page). > And does the row appear in MySQL? Regards, -- Thiago Henrique Pojda
Re: [PHP] After INSERT form submit - Data doesn't refresh!
Thijs jou should read the OP's statement again .. The OP wrote: . *(The INSERT function is executed before the SELECT in the page).*
Re: [PHP] After INSERT form submit - Data doesn't refresh!
Quoting "Rahul S. Johari" <[EMAIL PROTECTED]>: Here's what it is: I have a php page, "a.php", which contains these three things: - SELECT statement to display records from a mySQL Table - HTML Form for inserting data into the mySQL Table - INSERT statement to insert that row into the mySQL Table If the flow of you program really works in this order. Then i can understand you are looking at the same records after a INSERT. The SELECT query is run before the INSERT. So if you submit your INSERT form. The page first selects a record set from the database. And after that preforms the INSERT. The HTML Form submits to the same, "a.php" Once the user submits the Form, a.php is called which INSERT's the row into the mySQL Table. However, the row does not appear in the SELECT statement table data unless I hit refresh on the page. (The INSERT function is executed before the SELECT in the page). I used the header() code that was suggested: header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Pragma: no-cache'); $ffile = 'a.php'; $time = filemtime($ffile); header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT'); .. but it didn't help. Everything is working fine except that the Browser is more then likely caching the data and thus not allowing the newly inserted row to appear on top when the SELECT is executed. On Jul 22, 2008, at 8:34 AM, Thiago H. Pojda wrote: Code, please? :) On Tue, Jul 22, 2008 at 9:33 AM, Rahul S. Johari <[EMAIL PROTECTED] > wrote: Hmm, interesting. In my case, $file does indeed output dynamic data. I did try with the modified time but it still doesn't work. I still have to hit refresh on the browser, after submitting the form, in order for the inserted record to appear. Not sure what to do - it's rather annoying. Novice users of the page would assume the entry didn't get inserted or something happened. One alternate is to submit Data to a different page and let that page redirect to the Original page - but I do find it hard to believe that there is no solution to this caching. Thanks guys! On Jul 22, 2008, at 8:26 AM, Yeti wrote: The Last-Modified header tells the browser when the requested page was last modified. Now I don't know how you get the date in your case but here is an example: browser requests /test/test.php which is a simple php file without any includes etc. in this case $file = '/test/test.php'; This wont work if $file outputs dynamic data, so only use it if the content only changes when you change the file. Now if you are using templates etc. obtaining the Last-Modified time is a bit more complicated. If you use server side caching then you can chose the cached file else you have to figure it out yourself. And the RFC 2616 header specification says: An origin server MUST NOT send a Last-Modified date which is later than the server's time of message origination. In such cases, where the resource's last modification would indicate some time in the future, the server MUST replace that date with the message origination date. So do not send a future date! On Tue, Jul 22, 2008 at 2:11 PM, Rahul S. Johari <[EMAIL PROTECTED] > wrote: I tried with just the first three header() statements you gave, but it didn't work. Let me try the modification date ... which file is being referred to in $ffile? Also, I'm using Firefox, if it's of any consequence. Thanks! On Jul 22, 2008, at 7:30 AM, Bernhard Kohl wrote: I'm pretty sure this is a cache issue .. To disable caching: header('Cache-Control: no-cache, no-store, max-age=0, must- revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Pragma: no-cache'); But if you have the modification date then use $time = filemtime($ffile); header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT'); On Tue, Jul 22, 2008 at 1:14 PM, Rahul S. Johari <[EMAIL PROTECTED] > wrote: Ave, I'm wondering if there's a PHP solution to this, I could be in the wrong place. I have an INSERT form which submits to the same php page, which also displays the records from the mySQL database the INSERT form submits to. When the form submits and the page returns, the added record does not show up unless you "Refresh" the page. I'm imagining even after form submit, the Browser is caching the data and displaying data from the Cache. Is there a solution to this? Is there anything PHP can do to instruct the browser not the cache the data? Thanks! --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EM
Re: [PHP] After INSERT form submit - Data doesn't refresh!
Here's what it is: I have a php page, "a.php", which contains these three things: - SELECT statement to display records from a mySQL Table - HTML Form for inserting data into the mySQL Table - INSERT statement to insert that row into the mySQL Table The HTML Form submits to the same, "a.php" Once the user submits the Form, a.php is called which INSERT's the row into the mySQL Table. However, the row does not appear in the SELECT statement table data unless I hit refresh on the page. (The INSERT function is executed before the SELECT in the page). I used the header() code that was suggested: header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Pragma: no-cache'); $ffile = 'a.php'; $time = filemtime($ffile); header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT'); .. but it didn't help. Everything is working fine except that the Browser is more then likely caching the data and thus not allowing the newly inserted row to appear on top when the SELECT is executed. On Jul 22, 2008, at 8:34 AM, Thiago H. Pojda wrote: Code, please? :) On Tue, Jul 22, 2008 at 9:33 AM, Rahul S. Johari <[EMAIL PROTECTED] > wrote: Hmm, interesting. In my case, $file does indeed output dynamic data. I did try with the modified time but it still doesn't work. I still have to hit refresh on the browser, after submitting the form, in order for the inserted record to appear. Not sure what to do - it's rather annoying. Novice users of the page would assume the entry didn't get inserted or something happened. One alternate is to submit Data to a different page and let that page redirect to the Original page - but I do find it hard to believe that there is no solution to this caching. Thanks guys! On Jul 22, 2008, at 8:26 AM, Yeti wrote: The Last-Modified header tells the browser when the requested page was last modified. Now I don't know how you get the date in your case but here is an example: browser requests /test/test.php which is a simple php file without any includes etc. in this case $file = '/test/test.php'; This wont work if $file outputs dynamic data, so only use it if the content only changes when you change the file. Now if you are using templates etc. obtaining the Last-Modified time is a bit more complicated. If you use server side caching then you can chose the cached file else you have to figure it out yourself. And the RFC 2616 header specification says: An origin server MUST NOT send a Last-Modified date which is later than the server's time of message origination. In such cases, where the resource's last modification would indicate some time in the future, the server MUST replace that date with the message origination date. So do not send a future date! On Tue, Jul 22, 2008 at 2:11 PM, Rahul S. Johari <[EMAIL PROTECTED] > wrote: I tried with just the first three header() statements you gave, but it didn't work. Let me try the modification date ... which file is being referred to in $ffile? Also, I'm using Firefox, if it's of any consequence. Thanks! On Jul 22, 2008, at 7:30 AM, Bernhard Kohl wrote: I'm pretty sure this is a cache issue .. To disable caching: header('Cache-Control: no-cache, no-store, max-age=0, must- revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Pragma: no-cache'); But if you have the modification date then use $time = filemtime($ffile); header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT'); On Tue, Jul 22, 2008 at 1:14 PM, Rahul S. Johari <[EMAIL PROTECTED] > wrote: Ave, I'm wondering if there's a PHP solution to this, I could be in the wrong place. I have an INSERT form which submits to the same php page, which also displays the records from the mySQL database the INSERT form submits to. When the form submits and the page returns, the added record does not show up unless you "Refresh" the page. I'm imagining even after form submit, the Browser is caching the data and displaying data from the Cache. Is there a solution to this? Is there anything PHP can do to instruct the browser not the cache the data? Thanks! --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com -- Thiago Henrique Pojda --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com
Re: [PHP] After INSERT form submit - Data doesn't refresh!
Code, please? :) On Tue, Jul 22, 2008 at 9:33 AM, Rahul S. Johari < [EMAIL PROTECTED]> wrote: > > Hmm, interesting. > In my case, $file does indeed output dynamic data. > > I did try with the modified time but it still doesn't work. I still have to > hit refresh on the browser, after submitting the form, in order for the > inserted record to appear. > > Not sure what to do - it's rather annoying. Novice users of the page would > assume the entry didn't get inserted or something happened. One alternate is > to submit Data to a different page and let that page redirect to the > Original page - but I do find it hard to believe that there is no solution > to this caching. > > Thanks guys! > > > On Jul 22, 2008, at 8:26 AM, Yeti wrote: > > The Last-Modified header tells the browser when the requested page was >> last modified. Now I don't know how you get the date in your case but here >> is an example: >> >> browser requests /test/test.php which is a simple php file without any >> includes etc. >> >> in this case >> >> $file = '/test/test.php'; >> >> This wont work if $file outputs dynamic data, so only use it if the >> content only changes when you change the file. >> >> Now if you are using templates etc. obtaining the Last-Modified time is a >> bit more complicated. If you use server side caching then you can chose the >> cached file else you have to figure it out yourself. >> >> And the RFC 2616 header specification says: >> >> An origin server MUST NOT send a Last-Modified date which is later than >> the server's time of message origination. In such cases, where the >> resource's last modification would indicate some time in the future, the >> server MUST replace that date with the message origination date. >> >> So do not send a future date! >> >> >> >> On Tue, Jul 22, 2008 at 2:11 PM, Rahul S. Johari < >> [EMAIL PROTECTED]> wrote: >> >> I tried with just the first three header() statements you gave, but it >> didn't work. >> Let me try the modification date ... which file is being referred to in >> $ffile? >> >> Also, I'm using Firefox, if it's of any consequence. >> >> Thanks! >> >> On Jul 22, 2008, at 7:30 AM, Bernhard Kohl wrote: >> >> I'm pretty sure this is a cache issue .. >>> >>> To disable caching: >>> header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate'); >>> header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past >>> header('Pragma: no-cache'); >>> >>> But if you have the modification date then use >>> $time = filemtime($ffile); >>> header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT'); >>> >>> >>> On Tue, Jul 22, 2008 at 1:14 PM, Rahul S. Johari < >>> [EMAIL PROTECTED]> wrote: >>> Ave, >>> >>> I'm wondering if there's a PHP solution to this, I could be in the wrong >>> place. >>> I have an INSERT form which submits to the same php page, which also >>> displays the records from the mySQL database the INSERT form submits to. >>> When the form submits and the page returns, the added record does not show >>> up unless you "Refresh" the page. >>> >>> I'm imagining even after form submit, the Browser is caching the data and >>> displaying data from the Cache. >>> >>> Is there a solution to this? Is there anything PHP can do to instruct the >>> browser not the cache the data? >>> >>> Thanks! >>> >>> --- >>> Rahul Sitaram Johari >>> Founder, Internet Architects Group, Inc. >>> >>> [Email] [EMAIL PROTECTED] >>> [Web] http://www.rahulsjohari.com >>> >>> >>> >>> >>> >>> -- >>> PHP General Mailing List (http://www.php.net/) >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >>> >>> >> --- >> Rahul Sitaram Johari >> Founder, Internet Architects Group, Inc. >> >> [Email] [EMAIL PROTECTED] >> [Web] http://www.rahulsjohari.com >> >> >> >> >> >> > --- > Rahul Sitaram Johari > Founder, Internet Architects Group, Inc. > > [Email] [EMAIL PROTECTED] > [Web] http://www.rahulsjohari.com > > > > > -- Thiago Henrique Pojda
Re: [PHP] After INSERT form submit - Data doesn't refresh!
Hmm, interesting. In my case, $file does indeed output dynamic data. I did try with the modified time but it still doesn't work. I still have to hit refresh on the browser, after submitting the form, in order for the inserted record to appear. Not sure what to do - it's rather annoying. Novice users of the page would assume the entry didn't get inserted or something happened. One alternate is to submit Data to a different page and let that page redirect to the Original page - but I do find it hard to believe that there is no solution to this caching. Thanks guys! On Jul 22, 2008, at 8:26 AM, Yeti wrote: The Last-Modified header tells the browser when the requested page was last modified. Now I don't know how you get the date in your case but here is an example: browser requests /test/test.php which is a simple php file without any includes etc. in this case $file = '/test/test.php'; This wont work if $file outputs dynamic data, so only use it if the content only changes when you change the file. Now if you are using templates etc. obtaining the Last-Modified time is a bit more complicated. If you use server side caching then you can chose the cached file else you have to figure it out yourself. And the RFC 2616 header specification says: An origin server MUST NOT send a Last-Modified date which is later than the server's time of message origination. In such cases, where the resource's last modification would indicate some time in the future, the server MUST replace that date with the message origination date. So do not send a future date! On Tue, Jul 22, 2008 at 2:11 PM, Rahul S. Johari <[EMAIL PROTECTED] > wrote: I tried with just the first three header() statements you gave, but it didn't work. Let me try the modification date ... which file is being referred to in $ffile? Also, I'm using Firefox, if it's of any consequence. Thanks! On Jul 22, 2008, at 7:30 AM, Bernhard Kohl wrote: I'm pretty sure this is a cache issue .. To disable caching: header('Cache-Control: no-cache, no-store, max-age=0, must- revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Pragma: no-cache'); But if you have the modification date then use $time = filemtime($ffile); header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT'); On Tue, Jul 22, 2008 at 1:14 PM, Rahul S. Johari <[EMAIL PROTECTED] > wrote: Ave, I'm wondering if there's a PHP solution to this, I could be in the wrong place. I have an INSERT form which submits to the same php page, which also displays the records from the mySQL database the INSERT form submits to. When the form submits and the page returns, the added record does not show up unless you "Refresh" the page. I'm imagining even after form submit, the Browser is caching the data and displaying data from the Cache. Is there a solution to this? Is there anything PHP can do to instruct the browser not the cache the data? Thanks! --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com
Re: [PHP] After INSERT form submit - Data doesn't refresh!
I tried with just the first three header() statements you gave, but it didn't work. Let me try the modification date ... which file is being referred to in $ffile? Also, I'm using Firefox, if it's of any consequence. Thanks! On Jul 22, 2008, at 7:30 AM, Bernhard Kohl wrote: I'm pretty sure this is a cache issue .. To disable caching: header('Cache-Control: no-cache, no-store, max-age=0, must- revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Pragma: no-cache'); But if you have the modification date then use $time = filemtime($ffile); header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT'); On Tue, Jul 22, 2008 at 1:14 PM, Rahul S. Johari <[EMAIL PROTECTED] > wrote: Ave, I'm wondering if there's a PHP solution to this, I could be in the wrong place. I have an INSERT form which submits to the same php page, which also displays the records from the mySQL database the INSERT form submits to. When the form submits and the page returns, the added record does not show up unless you "Refresh" the page. I'm imagining even after form submit, the Browser is caching the data and displaying data from the Cache. Is there a solution to this? Is there anything PHP can do to instruct the browser not the cache the data? Thanks! --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com
Re: [PHP] After INSERT form submit - Data doesn't refresh!
I'm pretty sure this is a cache issue .. To disable caching:* header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Pragma: no-cache'); * But if you have the modification date then use *$time = filemtime($ffile); header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT'); * On Tue, Jul 22, 2008 at 1:14 PM, Rahul S. Johari < [EMAIL PROTECTED]> wrote: > Ave, > > I'm wondering if there's a PHP solution to this, I could be in the wrong > place. > I have an INSERT form which submits to the same php page, which also > displays the records from the mySQL database the INSERT form submits to. > When the form submits and the page returns, the added record does not show > up unless you "Refresh" the page. > > I'm imagining even after form submit, the Browser is caching the data and > displaying data from the Cache. > > Is there a solution to this? Is there anything PHP can do to instruct the > browser not the cache the data? > > Thanks! > > --- > Rahul Sitaram Johari > Founder, Internet Architects Group, Inc. > > [Email] [EMAIL PROTECTED] > [Web] http://www.rahulsjohari.com > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
[PHP] After INSERT form submit - Data doesn't refresh!
Ave, I'm wondering if there's a PHP solution to this, I could be in the wrong place. I have an INSERT form which submits to the same php page, which also displays the records from the mySQL database the INSERT form submits to. When the form submits and the page returns, the added record does not show up unless you "Refresh" the page. I'm imagining even after form submit, the Browser is caching the data and displaying data from the Cache. Is there a solution to this? Is there anything PHP can do to instruct the browser not the cache the data? Thanks! --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php