and additionally use exit; after echo statement in else part. This will automatically terminates the execution if condition not satisfied. Because, we should not use any output command before calling header() function..

Hope you can understand and solve your issue. If still probs, please let me know..

Edited 7 Years Ago
by Ezzaral: Added code tags. Please use them to format any code that you post.