1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP: Getting values from URL is not working

Discussion in 'Programming' started by Jangga, Mar 27, 2017.

Tags:
  1. Jangga

    Jangga Junior Member

    Joined:
    Aug 8, 2016
    Messages:
    123
    Likes Received:
    4
    Gender:
    Male
    Occupation:
    Freelancer: A reWriter
    Location:
    Africa
    Hello bosses, please I need your assistance. I'm trying to get details from users URL. It's not working. I'm getting error as unexpected T_variable

    Users URL looks like : http://www.mysite.com/user/[email protected]&pin=H5Dhs8Ruotsl

    My code is:
    <?
    if(isset($_GET['email']) AND isset($_GET['pin'])){

    $email=$_GET['email'];
    $pin=$_GET['pin'];

    //my db code goes here

    ?>

    The error occurs at the line having $email=$_GET['email'];

    I don't know what is wrong.... Pls say something
     
  2. mnunes532

    mnunes532 Supreme Member

    Joined:
    Jan 21, 2014
    Messages:
    1,434
    Likes Received:
    466
    Gender:
    Male
    Location:
    Portugal
  3. Jangga

    Jangga Junior Member

    Joined:
    Aug 8, 2016
    Messages:
    123
    Likes Received:
    4
    Gender:
    Male
    Occupation:
    Freelancer: A reWriter
    Location:
    Africa
  4. mnunes532

    mnunes532 Supreme Member

    Joined:
    Jan 21, 2014
    Messages:
    1,434
    Likes Received:
    466
    Gender:
    Male
    Location:
    Portugal
    What's the error?
     
  5. Jangga

    Jangga Junior Member

    Joined:
    Aug 8, 2016
    Messages:
    123
    Likes Received:
    4
    Gender:
    Male
    Occupation:
    Freelancer: A reWriter
    Location:
    Africa
    Parse error: syntax error, unexpected T_VARIABLE
    The error occurs at the line having $email=$_GET['email'];
    Thanks
     
  6. mnunes532

    mnunes532 Supreme Member

    Joined:
    Jan 21, 2014
    Messages:
    1,434
    Likes Received:
    466
    Gender:
    Male
    Location:
    Portugal
    At the beginning try writting <?php instead of just <?
     
  7. Jangga

    Jangga Junior Member

    Joined:
    Aug 8, 2016
    Messages:
    123
    Likes Received:
    4
    Gender:
    Male
    Occupation:
    Freelancer: A reWriter
    Location:
    Africa
    Just tried still not working... I don't know other way to get around this. Pls
     
  8. Conor

    Conor Elite Member

    Joined:
    Nov 7, 2012
    Messages:
    3,577
    Likes Received:
    5,954
    Gender:
    Male
    Location:
    South Africa
    Home Page:
    Try formatting your code nicely, changing <? to <?php, and I also see a missing } bracket.
     
  9. Jangga

    Jangga Junior Member

    Joined:
    Aug 8, 2016
    Messages:
    123
    Likes Received:
    4
    Gender:
    Male
    Occupation:
    Freelancer: A reWriter
    Location:
    Africa
    Yes, I ommited the bracket on pasting here since it wasn't relevant to the error. Or is it?
     
  10. mnunes532

    mnunes532 Supreme Member

    Joined:
    Jan 21, 2014
    Messages:
    1,434
    Likes Received:
    466
    Gender:
    Male
    Location:
    Portugal
    There's nothing wrong in that piece of code then, we need to see the rest so we can help you.
     
  11. Conor

    Conor Elite Member

    Joined:
    Nov 7, 2012
    Messages:
    3,577
    Likes Received:
    5,954
    Gender:
    Male
    Location:
    South Africa
    Home Page:
    It'd help to see the full piece of code to be sure.
     
  12. Jangga

    Jangga Junior Member

    Joined:
    Aug 8, 2016
    Messages:
    123
    Likes Received:
    4
    Gender:
    Male
    Occupation:
    Freelancer: A reWriter
    Location:
    Africa
    I cant post full code here, why?
     
  13. mnunes532

    mnunes532 Supreme Member

    Joined:
    Jan 21, 2014
    Messages:
    1,434
    Likes Received:
    466
    Gender:
    Male
    Location:
    Portugal
  14. Jangga

    Jangga Junior Member

    Joined:
    Aug 8, 2016
    Messages:
    123
    Likes Received:
    4
    Gender:
    Male
    Occupation:
    Freelancer: A reWriter
    Location:
    Africa
  15. pavan

    pavan Elite Member

    Joined:
    Mar 30, 2008
    Messages:
    1,819
    Likes Received:
    457
  16. teysuro

    teysuro Registered Member

    Joined:
    Sep 19, 2012
    Messages:
    72
    Likes Received:
    19
    Gender:
    Male
    Location:
    Netherlands
  17. Jangga

    Jangga Junior Member

    Joined:
    Aug 8, 2016
    Messages:
    123
    Likes Received:
    4
    Gender:
    Male
    Occupation:
    Freelancer: A reWriter
    Location:
    Africa

    U are the bomb waiting to explode! Problem solved!! Indians are good. I'm having my study in your country soon. Thanks man
     
  18. pavan

    pavan Elite Member

    Joined:
    Mar 30, 2008
    Messages:
    1,819
    Likes Received:
    457
    welcome bro!
    let me know if you need any further help
     
  19. Jangga

    Jangga Junior Member

    Joined:
    Aug 8, 2016
    Messages:
    123
    Likes Received:
    4
    Gender:
    Male
    Occupation:
    Freelancer: A reWriter
    Location:
    Africa
    Sharp. Thanks alot
     
  20. Conor

    Conor Elite Member

    Joined:
    Nov 7, 2012
    Messages:
    3,577
    Likes Received:
    5,954
    Gender:
    Male
    Location:
    South Africa
    Home Page:
    :D Never have I ever seen anyone else say "sharp" on a forum before. You are definitely from Africa LOL.

    Good job sorting your issue BTW.
     
    • Thanks Thanks x 1