php redirect

Discussion in 'PHP' started by gilgalbiblewheel, Dec 19, 2007.

  1. tushardhoot1

    tushardhoot1 Active Member

    Messages:
    3,013
    Likes Received:
    96
    Best Answers:
    0
    Trophy Points:
    90
    #21
    Hmm, weird.

    Take out the /> at the end and replace with >

    Sorry, looks like I won't be able to help you either.
     
    tushardhoot1, Dec 20, 2007 IP
  2. gilgalbiblewheel

    gilgalbiblewheel Well-Known Member

    Messages:
    435
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #22
    It worked but check out the syntax, where the quotes are:
    echo '<meta HTTP-EQUIV=REFRESH content="10; url=' .$newurl. '" />';
    PHP:
    Check the double quotes.
     
    gilgalbiblewheel, Dec 20, 2007 IP
  3. gilgalbiblewheel

    gilgalbiblewheel Well-Known Member

    Messages:
    435
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #23
    How do I eliminate a 0 from pg_0001.php to add a 1 instead?
     
    gilgalbiblewheel, Dec 20, 2007 IP
  4. itliberty

    itliberty Peon

    Messages:
    1,173
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #24
    you are doing it correctly but you cant do the echo prior to the header(Location)..if there is any output (even a single space) prior to the header (Location) it wont work. You will get a header already sent error message.

    You already create the value for newurl there is no reason to echo it..
     
    itliberty, Dec 20, 2007 IP
  5. tushardhoot1

    tushardhoot1 Active Member

    Messages:
    3,013
    Likes Received:
    96
    Best Answers:
    0
    Trophy Points:
    90
    #25
    Is there any way you could rename all the files to 0001.php instead of pg_001.php?

    That could make it a bit easier.

    $currenturl=$_SERVER['PHP_SELF'] /* Sets the variable for the current page */
    $newurl=substr($currenturl, -3); /* Changes the 0001.php to 001 in the servers eyes */
    $newurl2=sprintf($currenturl, +1) . ".php"; /* Adds a 1 to the current number. Ex. 001 becomes 002. */
    echo "<a href=$newurl2> Click Here to Continue! </a>";
    
    Code (markup):
     
    tushardhoot1, Dec 20, 2007 IP