Next time, Mukasa, try reading... Robert clearly states that he'd like a PHP function which TELLS him if the page has been refreshed or not (thus, "resent"). There are headers sent out that indicate this, and thus a function like refreshed() would be a shortcut to getting to know if it has.

He doesn't ask to FORCE a refresh, or to even execute PHP in a browser (what? how did you get to this...??)

Mukasa Assey Alfred wrote:


On Tue, 17 May 2005, Robert Meyer wrote:

As a last resort, I may have to do that, but that is by no means the
preferred method.  I want to keep database access to a minimum.

I thought by this time this problem would have had a standard solution. It
would be nice if PHP had a function like refreshed() so one could do ... if
(!refreshed()) { ... } ..., but I guess not.



PHP is a server-side programming language, the problem you are facing is a client-side problem. PHP thus would not be able to do browser refreshes! sorry! Unless of course you have a PHP enabled browser :-)


Your browser caches the information sent from the form and so long as the page is not reloaded..., the variables are still set and submition of data may continue indefinately.

Two options,

You may use the php header() funtion for redirection,
or
Resort to a client-side reload using a scripting language like javascript..., "document.location.href='....';


Assey.

Thanks for your input.

Regards,

Robert

"Marcus Joyce" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

Why dont you check that data isnt being duplicated?

$query = "SELECT auto_col FROM table where col1 = $var1 & col2 = $var
3.............";
$call_query = mysql_query($query,.......
$query_data = mysql_assoc($call_query);

if(!$query_data) { do form }

else echo "information already exists in database";


Pierce

Robert Meyer wrote:

Hello,

Scenario:
1) User is presented a blank form.
2) User fills in form.
3) User submits form.
4) Record is added to database.
5) Back to 1).
All is fine to here.
6) User clicks refresh.
7) Another record is added, same data except auto-increment field.
How do I prevent these last two steps, or at least prevent a record
from being added when refresh is clicked?

Regards,

Robert


-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to