Help passing variables through my function -- should be simple to answer!

Discussion in 'PHP' started by Crayz, Aug 2, 2007.

  1. #1
    Hello, I have this code:

       $_POST['username'] = $username; 
       $_POST['password'] = $password;
       userLogin($username,$password);
    Code (markup):
    And heres the function, userLogin:

    
    function userLogin($name, $pass) {
       echo $pass . $name;
    }
    
    Code (markup):
    But it doesn't seem to work!

    Any suggestions?

    Thanks!
     
    Crayz, Aug 2, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    
    $username = $_POST['username'];
    $password = $_POST['password'];
    
    PHP:
     
    nico_swd, Aug 2, 2007 IP
    Crayz likes this.
  3. Crayz

    Crayz Well-Known Member

    Messages:
    708
    Likes Received:
    9
    Best Answers:
    1
    Trophy Points:
    120
    #3
    Haha, i'v been coding in too much different languages lately. Forgot that the order of those make a difference.

    Thanks!
     
    Crayz, Aug 2, 2007 IP
  4. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #4
    What language assigns the value of the variable on the left to the variable on the right?
     
    krt, Aug 2, 2007 IP
  5. Crayz

    Crayz Well-Known Member

    Messages:
    708
    Likes Received:
    9
    Best Answers:
    1
    Trophy Points:
    120
    #5
    I was thinking c++, but I guess I was wrong, just did a little testing and it doesn't work. :(
    Coulda swore I'v done it before though.

    Oh well.
     
    Crayz, Aug 2, 2007 IP
  6. bloodredxxx

    bloodredxxx Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    was thinking the same thing...
     
    bloodredxxx, Aug 2, 2007 IP
  7. exodus

    exodus Well-Known Member

    Messages:
    1,900
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    165
    #7
    Just another example why you should code sober! No more jack and coke for you when your coding. (just joking around)
     
    exodus, Aug 2, 2007 IP