SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2000
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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?

    thx in advance.


  2. #2
    SitePoint Zealot oodie's Avatar
    Join Date
    Jul 2000
    Location
    Misty Mountain
    Posts
    125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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 :

    <META HTTP-EQUIV="refresh" content="5;URL=http://www.something.com/page.htm">

    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='.

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2000
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

    you've got a nice site btw..


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •