Jump to content

Recommended Posts

Hi,

 

I'm trying to figure out if I can get a redirect page to work, without needing to use the header("Location: page.php"); command.

 

I know with asp, there is a response.redirect for redirecting pages, but, with the header, I can only use this, if there is no output before calling the command.

 

Is there any method that can be used where I can process some code, if output is required, and depending on processing on the page, redirect it to another page, using a command similar to response.redirect?

 

I have seen the http_redirect, but I can only see this working with clearing buffers etc. I have also a redirect_to("page.php"); command, but I cannot get this to work.

 

I am using php 5.

 

Any help would be appreciated.

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/256333-php-redirect/
Share on other sites

asp uses output buffering to get around the problem with header redirects, the asp redirect is the same command.

 

You can use ob_start to start output buffering, make your decision, and if you need to redirect, kill the buffer and send the header.

Link to comment
https://forums.phpfreaks.com/topic/256333-php-redirect/#findComment-1314063
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.