Should I place everything in echo tags
A quick question involving PHP development, I seem to be wondering about this more and more as I develop more complex sites. Basically say we have a basic PHP / XHTML inbox (messaging system). I perform checks at the top (check if user is logged in, check if user has correct permissions etc). Then use the header(\'location:\') function if the authentication fails. The question is do I write the rest of the inbox code in a huge \'else\' block or just use standard html. I read somewhere about about it being bad to put any code after using the \'header\' function.
1 Answer
Just follow your header with
exit();Than it won't be a problem. see third example here Also you don't need a big echo like that, you can echo html like this aswell if you want: <?php //php stuff if(test){ ?> html here <?php } else{ ?> other html <?php } ?> Posted: MacOS 1 of 1 people found this answer helpful. Did you? Yes No |
© Advanced Web Core. All rights reserved