Forum Moderators: coopster

Message Too Old, No Replies

Form works 80% of the time

Can fiugure it out

         

nippi

5:54 am on Jul 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Site I designed is <snip>

The properties page has a form that allows for searching on the properties. For some reason, it seems to crash sometimes. then I refresht he page, and it works fine. Can not figure it out

Here is the code for the form

<modnote>the form worked perfectly, header problem, removed large code dump as per charter, read on for solution

[edited by: jatar_k at 12:57 am (utc) on July 23, 2003]

jatar_k

5:23 pm on Jul 17, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



hey nippi,

do you have any more detailed information as to how exactly it is misbehaving? Are there any error messages?

Any more info would make it much easier to suggest a possible problem.

When you say "crash sometimes" are there any similarities in data or behaviour when it crashes?

nippi

1:19 am on Jul 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The page cannot be displayed?

No PHP errors on the server, I click refresh, and it wokrs again. DO a few more searchs, and it fails.

ikbenhet1

1:24 am on Jul 18, 2003 (gmt 0)

10+ Year Member



This sound very much like a cache problem, can you add no-cache to check if that is the problem?

You can add this on top to force it not to cache the page.

<?
print "Content-type: text/html\n";
print "Pragma: nocache\n";
print "Cache-Control: no-cache, must-revalidate, no-store\n\n";
?>

Hope this works.
Cheers

nippi

2:05 am on Jul 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have this at the top

<?php

header("Content-type: text/html\n");
header("Pragma: nocache\n");
header("Cache-Control: no-cache, must-revalidate, no-store\n\n");
header("Expires: Thu,01 Jan 1970 00:00:00 GMT");?>

ikbenhet1

2:17 am on Jul 18, 2003 (gmt 0)

10+ Year Member



Are you using a free host? (i think not)

I looked some more and i found this header below which seems to have more details. I am not sure that the cache IS the problem, but i think it's certainly worth a shot.

<?php
// Date in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

// always modified
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");

// HTTP/1.1
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);

// HTTP/1.0
header("Pragma: no-cache");
?>

That's all i could find, hope some other members have any other maybe better ideas.

nippi

2:40 am on Jul 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I changed line 12 to this header("Cache-Control: post-check=0, pre-check=0, false");

?

<?php
// Date in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

// always modified
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");

// HTTP/1.1
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0, false");

// HTTP/1.0
header("Pragma: no-cache");
?>

Seems to work. Thanks very much if that was it!

nippi

2:43 am on Jul 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



As a newbie to php, coukld you give me a ltitle explanation why you thought caching was the problem?

What problems can caching cause?

nippi

3:21 am on Jul 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



well
did not work anyway

crash crash crash

argh!

ikbenhet1

10:17 am on Jul 18, 2003 (gmt 0)

10+ Year Member



I'm sorry to hear that.

I though it was the cache because when you hit f5 it did load correctly, all that with f5 does is it reloads the page again from the server, not from the cache.
(Hit CTRL-F5 a few times, if the error occurs again, it's definetly not the cache.)

I sometimes have this problem too, but only when the server is very busy and when i run "heavy" (php) applications, then it gives a 404.

I don't have a clear answer for this problem. Sorry.

gbaker123

10:25 pm on Jul 22, 2003 (gmt 0)

10+ Year Member



nippi. What is the code that you are using to process the form? Have you tried looking there? Another thing you might want to do is dump the contents of the form when it is submitted and make sure you get what you think you are.

Hope this helps,
George

nippi

12:49 am on Jul 23, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Embarrassing fixed, helps if you start a session

<?php
session_start();
// Date in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

// always modified
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");

// HTTP/1.1
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0, false");

// HTTP/1.0
header("Pragma: no-cache");
?>