Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Mar 2006
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    redirect with variable

    How can I redirect with variables

    I renamed page.php?id=1a2b3c to newpage.php?id=1a2b3c

    The 1a2b3c is a variable and changing.

    Thanks for any help

  • #2
    New Coder
    Join Date
    Mar 2005
    Posts
    50
    Thanks
    0
    Thanked 2 Times in 2 Posts
    see the munki click- was that so random?

  • #3
    New Coder
    Join Date
    Mar 2006
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks but I couldnt make anything from that page.

  • #4
    New Coder
    Join Date
    Aug 2005
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    not sure what you want but if you want to send users from page.php?id=1a2b3c to newpage.php?id=1a2b3c then maybe this might work if you paste this in page.php
    PHP Code:
    $yourid=$_GET["id"];
    echo 
    "<meta http-equiv=\"Refresh\" content=\"0;url=newpage.php?id=$yourid">"; 
    good luck

  • #5
    New Coder
    Join Date
    Mar 2006
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm getting the error below when using the code above.
    Parse error: parse error, unexpected $ in path/newpage.php on line 3

  • #6
    Regular Coder trib4lmaniac's Avatar
    Join Date
    Feb 2004
    Location
    Cornwall, UK
    Posts
    535
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by mobilehell
    not sure what you want but if you want to send users from page.php?id=1a2b3c to newpage.php?id=1a2b3c then maybe this might work if you paste this in page.php
    PHP Code:
    $yourid=$_GET["id"];
    echo 
    "<meta http-equiv=\"Refresh\" content=\"0;url=newpage.php?id=$yourid">"; 
    good luck
    Or simply (in page.php):
    PHP Code:
    header('Location: newpage.php?' $_SERVER['QUERY_STRING']); 

  • #7
    New Coder
    Join Date
    Mar 2006
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This worked great.
    I didnt want to add another line in my htaccess file.

    PHP Code:
    header('Location: newpage.php?' $_SERVER['QUERY_STRING']); 
    Thank you very much.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •