SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard
    Join Date
    May 2002
    Posts
    1,370
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    header redirect - passing vars

    Trying this a number of ways, this header redirect basically directs but what syntax could be used to pass the variable on as well?

    PHP Code:
     coming from:
    https://www.site.com/page1.php?val=10
     
     
    if($row_query['colA']<>'1')
    header("Location: https://www.site.com/page2.php?val='.$_GET_VARS['val'].'"); 
    elseif(
    $row_query['colA']=='1')
    header("Location: https://www.site.com/page3.php?val='.$_GET_VARS['val'].'"); 

  2. #2
    play of mind Ernie1's Avatar
    Join Date
    Sep 2005
    Posts
    1,252
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    if($row_query['colA']<>'1')
    header("Location: https://www.site.com/page2.php?val=".$_GET['val']); 
    elseif(
    $row_query['colA']=='1')
    header("Location: https://www.site.com/page3.php?val=".$_GET['val']); 
    my mobile portal
    ghiris.ro

  3. #3
    SitePoint Wizard
    Join Date
    May 2002
    Posts
    1,370
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Easy enough:

    PHP Code:
    if($row_query['colA']<>'1')
    header('Location: https://www.site.com/page2.php?val='.$HTTP_GET_VARS['val']); 
    elseif(
    $row_query['colA']=='1')
    header('Location: https://www.site.com/page3.php?val='.$HTTP_GET_VARS['val']); 

    Ernie1 - was editing as you posted. but thanks!

    PHP Code:
    Could also do from query like so:
    header('Location: https://www.site.com/page3.php?val='.$row_query['cont']); 
    The query may be a little better, come to think of it, since I'm filtering on sessions.

  4. #4
    play of mind Ernie1's Avatar
    Join Date
    Sep 2005
    Posts
    1,252
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $HTTP_GET_VARS contains the same initial information, but is not a superglobal. (Note that $HTTP_GET_VARS and $_GET are different variables and that PHP handles them as such)
    reserved.variables
    my mobile portal
    ghiris.ro


Bookmarks

Posting Permissions

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