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 3 of 3
  1. #1
    New Coder
    Join Date
    Jan 2012
    Posts
    33
    Thanks
    12
    Thanked 0 Times in 0 Posts

    echo $id without _get

    Hello everyone.
    I want to echo or print "$id", which works fine when using

    PHP Code:
    <?php echo $_GET[id] ;?>
    -

    I have this piece of code, which I use for another function that enables me to include files based on the $id when "_get" is not present.

    PHP Code:
    <?php
    if (isset($_GET['id']))
       {
       
    $Id $_GET['id'];
       }
    else
       {
       
    $id '135';
       }
    ?>
    So, how can I echo this ID without using the "_get" function? I have tried
    PHP Code:
    <?php echo [id] ;?>
    and

    PHP Code:
    <?php echo (isset(['id'])); ?>
    which haven't worked

    thanks in advance

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    I think you need
    Code:
    <?php
    if (isset($_GET['id']))
       {
       $id = $_GET['id'];
       }
    else
       {
       $id = '135';
       }
    
    echo $id;
    ?>
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • Users who have thanked abduraooft for this post:

    mulder (06-28-2012)

  • #3
    New Coder
    Join Date
    Jan 2012
    Posts
    33
    Thanks
    12
    Thanked 0 Times in 0 Posts
    ah, I knew it would be something simple. thank you very much, appreciate your help


  •  

    Tags for this Thread

    Posting Permissions

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