PHP: Redirect to the same page, changing $_GET.

Posted by Jonathan on Stack Overflow See other posts from Stack Overflow or by Jonathan
Published on 2010-05-28T23:32:20Z Indexed on 2010/05/28 23:42 UTC
Read the original article Hit count: 171

Filed under:
|
|

Hi, I have this PHP piece of code that gets $_GET['id'] (a number) and do some stuff with this. When its finished I need to increase that number ($_GET['id']) and redirect to the same page but with the new number (also using $_GET['id']).

I am doing something like this:

$ID = $_GET['id'];

// Some stuff here

// and then:

$newID = $ID++;

header('Location: http://localhost/something/something.php?id='.$newID);
exit;

The problem here is that the browser stop me from doing it and I get this error from the browser (Firefox) : "The page isn't redirecting properly. Firefox has detected that the server is redirecting the request for this address in a way that will never complete."

Some help here please!

© Stack Overflow or respective owner

Related posts about php

Related posts about redirect