Call exit() after header location call?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Harmony504
    New Member
    • Oct 2007
    • 14

    Call exit() after header location call?

    Does anyone know if you need to call exit() after every call to header('locatio n...')? I have found that on some forms that call themselves and redirect depending on POST data, I have had to add the exit() call.

    Any thoughts?
  • dlite922
    Recognized Expert Top Contributor
    • Dec 2007
    • 1586

    #2
    Originally posted by Harmony504
    Does anyone know if you need to call exit() after every call to header('locatio n...')? I have found that on some forms that call themselves and redirect depending on POST data, I have had to add the exit() call.

    Any thoughts?
    I've never called the exit after my header changes.

    worked like a charm.

    Comment

    • ronverdonk
      Recognized Expert Specialist
      • Jul 2006
      • 4259

      #3
      After you call header() your script still continues processing, so an exit() is appriopriate to halt procesing the currrent script.

      ronald

      Comment

      • dlite922
        Recognized Expert Top Contributor
        • Dec 2007
        • 1586

        #4
        Originally posted by ronverdonk
        After you call header() your script still continues processing, so an exit() is appriopriate to halt procesing the currrent script.

        ronald
        I'll shut up. =X

        But thanks though. When it works, doesn't mean it's the right way necessarily.

        Comment

        Working...