Re: Opening another page in code

From: Date: Thu, 26 Jul 2001 03:54:02 +0000
Subject: Re: Opening another page in code
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-59675@lists.php.net to get a copy of this message
On Wed, 25 Jul 2001 07:30:03 -0600, ngoforth@earthnet.net (Nelson Goforth) wrote: >I just want to open another page, sending some parameters, at a point >in a script - without the user clicking on anything (I can do this in >a form - I want to do it WITHOUT the form). > >Like: if($test) { > GO_TO_PAGE (http://www.site.dom/page.php?id=838383); > } > >Except with code that actually works, of course. > >I tried "header (Location:...)" but got an error message that I can't >add to the headers. to clarify: so while the script is running (ON THE SERVER, it has not yet arrived at the client browser), there are several logic paths and some of them don't involve you printing anything to the browser, instead you just want to jump to another site/page. OK. the simplest solution is to redirect as you've tried above. if that doesn't work then the reason is, you've already printed something out to stdout and once you've done that you can't send headers anymore. to work around this, you would use the output buffering functions: www.php.net/manual/ref.outcontrol.php there are other workarounds, but that's the simplest. platypus

« previous php.general (#59675) next »