Jump to content


Photo

Redirecting


  • Please log in to reply
5 replies to this topic

#1 ari_aaron

ari_aaron
  • Members
  • PipPipPip
  • Advanced Member
  • 50 posts
  • LocationToronto, Canada

Posted 31 March 2006 - 02:02 AM

How can I make a page execute some code, and then go to another page?

#2 High_-_Tek

High_-_Tek
  • Members
  • PipPipPip
  • Advanced Member
  • 72 posts

Posted 31 March 2006 - 02:21 AM

<?php

$var=1;
$vat++;

header("Location: index.php");
?>


#3 play_

play_
  • Staff Alumni
  • Advanced Member
  • 717 posts

Posted 31 March 2006 - 02:44 AM

Just to be on the safeside, ill add 2 lines of code to high - tek's post.

<?php
ob_start();

$var=1;
$vat++;

header("Location: index.php");
ob_end_flush();
?>

regex.kat.sh --- regex library
u.kat.sh ---- url shortener
tabbit.org ---- tabbed pastebin

#4 ari_aaron

ari_aaron
  • Members
  • PipPipPip
  • Advanced Member
  • 50 posts
  • LocationToronto, Canada

Posted 31 March 2006 - 02:50 AM

What does "ob_start();" do?

#5 shortj75

shortj75
  • Members
  • PipPipPip
  • Advanced Member
  • 118 posts
  • LocationPort Huron,mi

Posted 01 April 2006 - 08:43 AM

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
The Short One

hopfully this helps if it doesn't sorry
i won't write the code for you!!! you don't learn that way

#6 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 01 April 2006 - 11:19 AM

There is no reason for you to use ob_start(); for what high-tek has posted!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users