ari_aaron Posted March 31, 2006 Share Posted March 31, 2006 How can I make a page execute some code, and then go to another page? Link to comment https://forums.phpfreaks.com/topic/6230-redirecting/ Share on other sites More sharing options...
High_-_Tek Posted March 31, 2006 Share Posted March 31, 2006 [code]<?php$var=1;$vat++;header("Location: index.php");?>[/code] Link to comment https://forums.phpfreaks.com/topic/6230-redirecting/#findComment-22511 Share on other sites More sharing options...
play_ Posted March 31, 2006 Share Posted March 31, 2006 Just to be on the safeside, ill add 2 lines of code to high - tek's post.[code]<?phpob_start();$var=1;$vat++;header("Location: index.php");ob_end_flush();?>[/code] Link to comment https://forums.phpfreaks.com/topic/6230-redirecting/#findComment-22521 Share on other sites More sharing options...
ari_aaron Posted March 31, 2006 Author Share Posted March 31, 2006 What does "ob_start();" do? Link to comment https://forums.phpfreaks.com/topic/6230-redirecting/#findComment-22522 Share on other sites More sharing options...
shortj75 Posted April 1, 2006 Share Posted April 1, 2006 your ob_flush(); will not execute once your code reaches header("Location: index.php"); the page will forward you to the index.php page so if you want the ob_flush() to work move it above the header code Link to comment https://forums.phpfreaks.com/topic/6230-redirecting/#findComment-22836 Share on other sites More sharing options...
wildteen88 Posted April 1, 2006 Share Posted April 1, 2006 There is no reason for you to use ob_start(); for what high-tek has posted! Link to comment https://forums.phpfreaks.com/topic/6230-redirecting/#findComment-22856 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.