Re: Reload a page when a user press the back button

From: Date: Sun, 19 Aug 2001 02:05:11 +0000
Subject: Re: Reload a page when a user press the back button
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-63335@lists.php.net to get a copy of this message
>not show after the user press the reload button. Is there a way that the page reaload >automatically the data from the database without the user pressing the reload button? Thanks Not really -- You can send no-cache and expiration headers, so they'll *HAVE* to reload to see anything at all, but it won't auto-reload. Another option: Have the page POST to itself, and re-generate the new list after the INSERT. Here's a crude example: <?php if (isset($newcat)){ $query = "insert into categories(name) values('$newcat')"; mysql_query($query) or die("Could not execute $query"); } $query = "select id, name from categories order by name"; $cats = mysql_query($query) or die("Could not execute $query"); echo "<FORM ACTION=$PHP_SELF METHOD=POST>\n"; echo "<SELECT>\n"; while (list($id, $name) = mysql_fetch_row($cats)){ echo "<OPTION VALUE=$id>$name</OPTION>\n"; } echo "</SELECT><BR>\n"; echo "<INPUT NAME=newcat><BR>\n"; echo "<INPUT TYPE=SUBMIT>\n"; echo "<FORM>\n"; ?> Since the INSERT happens at the top, the new entry will always show up as he goes. -- WARNING richard@zend.com address is an endangered species -- Use ceo@l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm

« previous php.general (#63335) next »