Jump to content
xisto Community
awesomebill61

Http_redirect() [resolved]

Recommended Posts

i am writing a script, and whenever i use this line

http_redirect("process.cgi");
i get a call to undefined function error for http_redirect().

maybe i am misunderstanding what this function is used for..... when i call it, it will take the user to the page indicated... in my case "process.cgi"
that was my interpretation of it from the page in the php manual.

i am running xampp for windows and php 5.2.1

Share this post


Link to post
Share on other sites

php.net reference page here: http://forums.xisto.com/no_longer_exists/

I believe this function requires the PECL Class installed, but I could be wrong. Do you know if you have that in place?
also, do you have any other output PRIOR to this call, since it issues Headers and NOTHING can precede the Header in the page output. Even a blank line sent to the HTML page will cause a problem with Headers being sent.

You may require a different function. Here is a sample of a re-direct that I use. It builds the re-derict URL from scratch.

// Start defining the URL.	$url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);	// Check for a trailing slash.	if ((substr($url, -1) == '/') OR (substr($url, -1) == '\\') ) {		$url = substr ($url, 0, -1); // Chop off the slash.	}	$url .= '/index.php'; // Add the page. Change the filename to suit.	header("Location: $url");	exit(); // Quit the script.
This was written to redirect within an application. If you need to re-direct to another location on the web, I would suggest another method.

Share this post


Link to post
Share on other sites

Topic is resolved.Please PM any moderator to continue this discussion. Until then, this topic is closed.

Share this post


Link to post
Share on other sites

redirect problem

Http_redirect() [resolved]

 

But how to redirect after using include and require?

 

The header says error.

 

Warning: Cannot modify header information - headers already sent by (output started at C:AppServwwwaacsfilesheadl.Inc:23) in C:AppServwwwaacsklub.Php on line 537

 

-reply by Asterixs

Share this post


Link to post
Share on other sites

Re:http_redirect

Http_redirect() [resolved]

 

Replying to iGuest

You can use this code:

 

PHPTAGOPEN

Ob_start();

PHPTAGCLOSE

 

/////

Your code ,include header(location:...);

////

 

PHPTAGOPEN

Ob_end_flush();

PHPTAGCLOSE

 

-reply by azade

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.