Click to See Complete Forum and Search --> : back to previous page


gigglesnorter
05-09-2005, 01:31 AM
Good day,
I have a page that puts some data in a database. When there is an error, I would like it to display an error, wait 10 seconds and then return to the previous page. All in the php code.

How do I make it wait 10 seconds?

How do I make it go to the previous page?

Thanks in advance,
Chris

NogDog
05-09-2005, 02:46 AM
Ouput this "meta redirect" to the <head> section of the error page:

<meta http-equiv="Refresh" content="10;http://www.site.com/previous_page.html">

gigglesnorter
05-09-2005, 04:28 AM
I am trying to achieve this in php code. The page attemps to save the data to the database and if there is a problem, it tells you and then goes back. I have found the command sleep(10); waits 10 seconds, now I need the php code for it to go back.

bokeh
05-09-2005, 05:20 AM
if(condition){
sleep(10);
header ('Location:' . $_SERVER['PHP_SELF']);
}


But I'm sure this is not what you want to do. You really need to make the form sticky and get them to correct any errornous data. For example remove the faulty data and highlight the field in pink to draw attention to the problem.