I'm interested in using the php header() function in a form that inserts data into a database. After successful submission, the form should momentarily display a "Submission successful" type page, and then use the header() function to redirect to another page, but at php.net I saw no mention of a time attribute that would let the current page display for a few seconds before header() loads the new location.
Anyone know if header() supports a time or wait attribute?
header() must be called before ANY output is sent. Even a single space sent to browser will make header() doesn't work. So calling header() after you print "Submission successful" won't work. Use META tag instead :
It will redirect user in 5 seconds. So your form's output should be like this :
<HTML>
<HEAD>
<META HTTP-EQUIV="refresh" content="5;URL=http://www.something.com/page.htm">
</HEAD>
<BODY>
Submission successful! <BR>
You will be redirected in 5 seconds.
</BODY>
</HTML>
You can change the delay by changing the number after 'content='.
thx for the suggestion oodie, thats prolly the best way to go with things anyway, I was aware of the meta refresh method, but was just kinda curious about any extra features of the header() function.
Bookmarks