Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Dec 2005
    Posts
    346
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Exit () vs Die()

    I know that it stops the script dead, but how would I make it just stop the current script. Lets say I am making a script that lets a user enter info, but if the info he provided doesn't meet my character requirements so I use the exit; or die; & show the form again.

    I would like to for the rest of my site to finish loading, but for the processing script for the info to stop only. Like for my footer of my page I have it in a footer.php & include it at the bottom of each page. When I use the exit function the footer wont load since the page has been stopped dead.

    If I haven't explained clearly I can explain more....


    Thanks!

  • #2
    $object->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Jun 2003
    Posts
    3,088
    Thanks
    2
    Thanked 23 Times in 23 Posts
    According to the manual, exit and die do the same thing - output a message and terminate the current script. Just wrap your script in a gigantic "if" condition. Process the script if the condition is met. Don't process the script if it isn't.
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    SNAP to it!

  • #3
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    to exit processing of an include'd script, you can use 'return false'. The page that included it will carry on.


  •  

    Posting Permissions

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