Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

php self posting - how do you stop resend data message 2

Status
Not open for further replies.

mrmtek

Programmer
Oct 13, 2002
109
0
0
AU
We have a self posting form that contains bid information (the page refreshes every 40 seconds) on our products on offer, after a user has entered a bid and submitted the form and when the form refreshes again we get a message window to resend the data, how do you stop this message from appearing after a user first submits a bid.
 
instead of refreshing the page could you reload it dynamically (ie using the $_SERVER['PHP_SELF'] variable in the javascript onload )?
or could you use the get method rather than the post method? (this would not ask the user to resend the data but it would make the url untidy.
 
$_SERVER['PHP_SELF' disables the whole page and using the get method is out of the question?? is there a php scripting method or javascript option??
 
>>refreshes again we get a message window to resend the data

to avoid that use an intermediary page, when the user submits a bid take him to another page where database is pdated and redirect back to the bids page, the dialog box appears only when data has been submitted to a page and the page is refreshed...

Known is handfull, Unknown is worldfull
 
disables the whole page
what do you mean by this?

for a javascript solution try the following code. to test it press submit and then press F5 (refresh) within 20 seconds. you will get the post data message as before. try again but leave it for 20 seconds. the page will reload and no warning message will be received.

Code:
<head>
<script language="JavaScript">
// CREDITS:
// Automatic Page Refresher by Peter Gehrig and Urs Dudli [URL unfurl="true"]www.24fun.com[/URL]
// Permission given to use the script provided that this notice remains as is.
// Additional scripts can be found at [URL unfurl="true"]http://www.hypergfurl.com.[/URL]


// Configure refresh interval (in seconds)
var refreshinterval=20;

// Shall the coundown be displayed inside your status bar? Say "yes" or "no" below:
var displaycountdown="yes";

// Do not edit the code below
var starttime;
var nowtime;
var reloadseconds=0;
var secondssinceloaded=0;

function starttime() {
	starttime=new Date();
	starttime=starttime.getTime();
    countdown();
}

function countdown() {
	nowtime= new Date();
	nowtime=nowtime.getTime();
	secondssinceloaded=(nowtime-starttime)/1000;
	reloadseconds=Math.round(refreshinterval-secondssinceloaded);
	if (refreshinterval>=secondssinceloaded) {
        var timer=setTimeout("countdown()",1000);
		if (displaycountdown=="yes") {
			window.status="Page refreshing in "+reloadseconds+ " seconds";
		}
    }
    else {
        clearTimeout(timer);
		window.location.href="<?=$_SERVER['PHP_SELF']?>";
    } 
}
window.onload=starttime;
</script>
</head>
<body>
<form method="post" action=#>
<input type="text" name="textfield" value="test" />
<input type="submit" name="submit" value = "submit" />
</form>
</body>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top