I got a little problem. When I got my PHP script without header it\'s fine, I am getting javascript alert box. But when I use header before alert it\'s not working. It\'s re
Your error is in the structure of your code. PHP, even in OOP is procedural and will run each line one after the other. So the way you've structured your code means the page is redirected before your echo. A better method is to use the javascript alert box to redirect your page using:
var prompt=window.confirm("message here. \r\n"+"Do you want to redirect?");
if(prompt)document.location.href='http://dunno.com/file.php');