PHP die() function

AusQB

New Member
I'm starting to work with sessions and cookies, typical login stuff.

I have a register form page, which is recursively called by the form.

ie.

PHP:
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">


The code that runs if the form has been submitted does a number of checks, each one performing a die() operation if the check fails. Since I didn't want this appearing on a new page, I simply included the form before the die() function.

This achieves what I want, as the error message is displayed below the form (somewhat emulating a JQuery approach) but any PHP scripts after that point are ignored, which is concerning because I have a footer include at the bottom of each page, which now isn't being called.


Is there a way around this, or should I switch to JQuery completely?
 
If you are using auto append file on your php.ini, be carefull on using die anywhere you want your appended file to be called. Souds obvious now but took me a good 1 hour to realise why one script was not appending end file as expected. I solved using `return` instead; it works anywhere not just inside functions and the effect is pretty much the same as die.
 
Top