jtorral Posted April 8, 2010 Share Posted April 8, 2010 What in tarnation is going on here? This is driving me NUTS !!!!!! None This code is in between some other code. Whatever I do, it still does not redirect using header or javascript. What am I missing here????? FYI, I have output_buffering turned on in my php configuration file. the function mymonitor just return the num rows returned from a query. Everything works except the redirect. I have header commented out because I was also trying a java redirect. if ( isset($_REQUEST['reset']) ) { $reset = $_REQUEST['reset']; if( mymonitor($reset) == 0 ) { error_message("You cannot edit a monitor you do not own"); } resetsendmessages($reset); resetattempts($reset); resetnotified($reset); //header("Location http://www.icameradb.com"); ?> <script language="JavaScript" type="text/javascript"> <!-- window.location.href = "http://www.icameradb.com" //--> </script> <? } Thanks for looking. Quote Link to comment https://forums.phpfreaks.com/topic/198028-arg-i-am-going-crazy-with-header-function/ Share on other sites More sharing options...
roopurt18 Posted April 8, 2010 Share Posted April 8, 2010 header("Location: http://www.icameradb.com"); exit(); Quote Link to comment https://forums.phpfreaks.com/topic/198028-arg-i-am-going-crazy-with-header-function/#findComment-1039099 Share on other sites More sharing options...
br0ken Posted April 8, 2010 Share Posted April 8, 2010 You need a semi colon after Location. <?php header("Location: http://www.google.com"); exit; // Also, always add an exit after your header ?> Quote Link to comment https://forums.phpfreaks.com/topic/198028-arg-i-am-going-crazy-with-header-function/#findComment-1039101 Share on other sites More sharing options...
ialsoagree Posted April 8, 2010 Share Posted April 8, 2010 As the above poster, you forgot the colon after Location. For javascript, location.href returns the current url, it doesn't let you change it: <!-- window.location.assign("http://www.icameradb.com") //--> Quote Link to comment https://forums.phpfreaks.com/topic/198028-arg-i-am-going-crazy-with-header-function/#findComment-1039102 Share on other sites More sharing options...
premiso Posted April 8, 2010 Share Posted April 8, 2010 If the above suggestions do not work, chances are your script is erroring out before it hits the header call. Make sure error reporting is set to E_ALL and display errors is turned on for development so you can actively see the error and debug properly. Quote Link to comment https://forums.phpfreaks.com/topic/198028-arg-i-am-going-crazy-with-header-function/#findComment-1039107 Share on other sites More sharing options...
jtorral Posted April 8, 2010 Author Share Posted April 8, 2010 You need a semi colon after Location. I can't believe I missed that ! Thanks! <?php header("Location: http://www.google.com"); exit; // Also, always add an exit after your header ?> Quote Link to comment https://forums.phpfreaks.com/topic/198028-arg-i-am-going-crazy-with-header-function/#findComment-1039115 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.