Jump to content

[SOLVED] header("Location: ") problems


Boo-urns

Recommended Posts

I just moved my test site to a subdomain, and now the header redirect is not working.  I changed it from relative to absolute path and it is only working some of the time, otherwise it will take roughly 122 seconds in FF3 to do the redirect.  I did check out all of my form post / database submission and it turned out just to be the header redirect.  Has anyone experienced this and any suggestions? Thanks

Link to comment
Share on other sites

The problem was I had a

 

<?php
if($error != 1) {
    header("Location: next.php");
}
?>

But i never initialized the value, only if there was an error, never had that problem before but now I must initialize it. Hope this helps someone with this problem.

Link to comment
Share on other sites

Hmm...that wasn't the problem.I took out all programming except for:

 

<?php
if(isset($_POST['submitForm'])){

	//redirect to this page but w/ submitted
	header("Location: http://subdomain.domain.com/test-sites/register.php?success=true");

}//end of submit
?>

 

Corresponding button =

<input type="submit" name="submitForm" id="submitbutton" value="Submit" />

Link to comment
Share on other sites

That code should have worked. I tested on my server and it worked fine. I believe this to either be a server issue, or a php.ini error. I believe there to be a setting in there that allows for redirection with PHP. Are you renting a server/domain, or is this on your own machine. And what version of PHP are you running?

Link to comment
Share on other sites

Yea I know it should work which is weird it has to be something with the file I'm guessing. I did try a redirect with PHP on another page and it worked fine, not sure why this would be held up.

 

Yea renting a server and domain.

PHP is 5.2.6

 

Could some javascript be getting in the way?

Link to comment
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.