RE: redirecting to a page

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Remember, though, you can't set an HTTP header after you've sent output to the client, so you needc to do your redirecting (assuming there's a condition) before you display ANYTHING.

BAD:
 <HTML><BODY>
  if (somecondition) { Redirect(www.mypage.com); }
  ...

GOOD:
 <?php 
  if (somecondition) {
    <HTML><BODY>
  } else {
   Redirect(www.mypage.com);
  }

HTH, 

matt

> -----Original Message-----
> From: Hutchins, Richard [mailto:Richard.Hutchins@Getingeusa.com]
> Sent: Friday, May 30, 2003 10:26 AM
> To: 'Rick Dahl'; php-db@lists.php.net
> Subject: RE:  redirecting to a page
> 
> 
> Redirect(www.mypage.com);
> 
> > -----Original Message-----
> > From: Rick Dahl [mailto:dmbserver@hotmail.com]
> > Sent: Friday, May 30, 2003 10:23 AM
> > To: php-db@lists.php.net
> > Subject:  redirecting to a page
> > 
> > 
> > I need to redirect to another page once some scripts that I 
> > can't alter run.  
> > 
> > I have this function at the top of my page: 
> > 
> > <?
> >   function Redirect ($url) {
> >      Header ("Location: " . $url);
> >      exit;
> >   }
> > ?>
> > 
> > How do I call the function?
> > 
> > Rick
> > 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux