PHP variables not passing between pages

Discussion in 'PHP' started by Darden12, Dec 19, 2009.

  1. #1
    I've done this hundreds of times before and for some reason today it's not working. Can anyone tell me why?

    I have one page with a link as follows:

    add.php?IDvalue=251
    PHP:
    The add.php page referenced in the URL begins with the following PHP:

    $IDvalue=$_REQUEST['IDvalue'];
    PHP:
    The problem is, when I click on the link mentioned, the IDvalue does NOT pass to the add.php page as it should. Does anyone know what the problem might be? This way of passing variable values has always worked for me before today.

    Thanks!
    Brian
     
    Darden12, Dec 19, 2009 IP
  2. Darden12

    Darden12 Well-Known Member

    Messages:
    107
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #2
    I figured it out, but I'll post the answer here if someone else ever has this problem.

    I had the following incorrectly coded conditional statement immediately following the IDvalue=$_REQUEST['IDvalue'] code on my add.php page.

    This conditional (missing double ==) somehow UNSET the IDvalue variable, though I'm not sure why a conditional statement (even when miswritten) would change the value of a variable.
     
    Darden12, Dec 19, 2009 IP
  3. astkboy2008

    astkboy2008 Peon

    Messages:
    211
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #3
    you should using get
     
    astkboy2008, Dec 19, 2009 IP
  4. Darden12

    Darden12 Well-Known Member

    Messages:
    107
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #4
    Thanks for the tip. I'll try it.
     
    Darden12, Dec 19, 2009 IP
  5. NodLemon

    NodLemon Peon

    Messages:
    27
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    $number = 5; // assign a value: 5
    $number == 5; // returns true
    PHP:
    Conditional statement or not, it'll still do it's job.
     
    NodLemon, Dec 19, 2009 IP