gum1982 Posted November 26, 2009 Share Posted November 26, 2009 Can someone please tell me why my header redirect isnt working. The field created_at is just pulling a field out off the database i haven't added this code. If i put echo "expired"; instead off the header redirect that outputs fine $exp_date = $field['created_at']; echo "Database ".$exp_date.'<br />'; $todays_date = date("Y-m-j H:i:s"); echo "Today ".$todays_date.'<br />'; $expiration_date = strtotime($exp_date); echo "Database ".$expiration_date.'<br />'; $today = strtotime($todays_date); echo "Today ".$today.'<br />'; if ($expiration_date > $today) { echo "Welcome"; } else { header("Location: http://www.example.com/"); exit; } Quote Link to comment https://forums.phpfreaks.com/topic/183028-header-redirect/ Share on other sites More sharing options...
premiso Posted November 26, 2009 Share Posted November 26, 2009 header You are echoing output before making the header call, you cannot have any type of output before a header call. http://www.phpfreaks.com/forums/index.php/topic,37442.0.html will also be helpful. Quote Link to comment https://forums.phpfreaks.com/topic/183028-header-redirect/#findComment-965971 Share on other sites More sharing options...
gum1982 Posted November 26, 2009 Author Share Posted November 26, 2009 Ah right thanks works now. Quote Link to comment https://forums.phpfreaks.com/topic/183028-header-redirect/#findComment-965972 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.