Forum Moderators: coopster

Message Too Old, No Replies

Page refresh without loop

         

outdoorxtreme1

6:30 pm on Oct 26, 2005 (gmt 0)

10+ Year Member



How do I get a php page to refresh once when entering the page and to keep from going into a loop?

coopster

6:40 pm on Oct 26, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Why would you need to refresh when you first enter the page? It just got *refreshed* when the server dished it up.

outdoorxtreme1

6:44 pm on Oct 26, 2005 (gmt 0)

10+ Year Member



For some reason the data is not refreshed. I have to click on refresh at the top of the screen

outdoorxtreme1

6:44 pm on Oct 26, 2005 (gmt 0)

10+ Year Member



let me check it again to make sure

outdoorxtreme1

6:47 pm on Oct 26, 2005 (gmt 0)

10+ Year Member



yep. I go to see a list of info I just posted and the new info is not there. If I refresh then it appears.

outdoorxtreme1

6:52 pm on Oct 26, 2005 (gmt 0)

10+ Year Member



Am I missing something in my code?

$connection = mysql_connect($host,$user,$pass) or die (mysql_errno().": ".mysql_error()."<BR>");
mysql_select_db($dbname);

$sql = 'SELECT * FROM tripreport';
$result = mysql_query($sql) or die ('<p>select died: ' . mysql_error());

echo '<p><center><strong>Trip Reports</strong></center><br>';
while ($row = mysql_fetch_array($result)) {
echo '<div><strong><a href="report.php?trip=',$row['trip_id'],'">',$row['triplocation'],'</a></strong> - ',$row['TSpickMonth'],' ',$row['TSpickDay'],', ',$row['TSpickYear'],'<br>';
}

echo '<br>';
echo '<A href="javascript:history.back(1)">
Back</A>';

?>

jatar_k

7:39 pm on Oct 26, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



can you explain the logic for me

what steps are taken?

click to enter new trip form (does this come from the list page?)
hit submit

you insert the new row and redirect to the list?
do you use the header function?

is this IE? could just be it's idiotic preference to not reload pages, maybe a no cache meta header might help?

outdoorxtreme1

8:05 pm on Oct 26, 2005 (gmt 0)

10+ Year Member



Yes. It is IE.
I have a page that has a link to the submit form page and a link to a report list page.

from there I click on submit report.
Hit submit

Insert new row nad it redirects to the page withthe 2 links.

Would I put the no cache meta header function on the report list page?

soflution

8:11 pm on Oct 26, 2005 (gmt 0)

10+ Year Member



Check your apache settings

jatar_k

8:14 pm on Oct 26, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



>> on the report list page

if that is the page that isn't showing the new data until you reload it then yes

something like this in the <head> portion of the html document, it's just a meta tag

<meta http-equiv="pragma" content="no-cache">

outdoorxtreme1

8:22 pm on Oct 26, 2005 (gmt 0)

10+ Year Member



the "report_list.php" is just all php code. How do I add Html and php together?

jatar_k

8:24 pm on Oct 26, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



there has to be some html somewhere as the page needs to be properly constructed

hmm, maybe that is the problem

is the code posted above (msg 6) the only code there is on the page?

outdoorxtreme1

8:28 pm on Oct 26, 2005 (gmt 0)

10+ Year Member



I use html and leave the page extension .php?

jatar_k

8:39 pm on Oct 26, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



the actual code that is sent to the browser is just html

page extensions are trivial for the most part