PDA

View Full Version : PHP redirect not working



CrusaderAD
May 7th, 2012, 03:20 PM
I need to do a PHP redirect at the bottom of the script after everything executes, so a redirect in the header doesn't work. I tried putting


<script type="text/javascript">
<!--
window.location = "http://www.google.com/"
//-->
</script>

At the bottom outside the php tags, but it doesn't redirect. Any ideas?

Barrucadu
May 7th, 2012, 07:16 PM
You can redirect with a header, as long as nothing is output.

CrusaderAD
May 7th, 2012, 07:26 PM
You can redirect with a header, as long as nothing is output.

There is data being outputted that is in turn being printed. So I can't use a header.

v8YKxgHe
May 7th, 2012, 07:28 PM
You should rework your logic ... having data being supplied to the user but then wanting to redirect straight away makes zero sense.