All your 'exit' instruction are surplus to requirements and will stop things happening as you intended.
Also, because you are using redirection, you need to buffer the output that goes back to the browser until you have made you decision.
Do this by adding;
- Code: Select all
ob_start();
at the very top of your page and make your last bit of
php code;
- Code: Select all
ob_end_flush();