ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Access GET Variables

June 16, 2011 6:39pm

Subscribe [4]
  • #1 / Jun 16, 2011 6:39pm

    james Brown

    492 posts

    Hello. I’m having some trouble accessing some GET variable in my url. They are in the form http://www.domain.com/page/name/?pid=value

    I have something in an embed on the page like this:

    <?php
    $pid = $this->EE->input->get('pid');
    echo $pid;
    ?>

    It doesn’t output anything. What am I doing wrong here?

  • #2 / Jun 17, 2011 1:44pm

    Sue Crocker

    26054 posts

    Hi, James. What is it you’re trying to do?

  • #3 / Jun 17, 2011 2:35pm

    james Brown

    492 posts

    I’m just needing to access the GET variable in the URL to use in my template. I’m using it on input so I can compare it against a value in EE.

  • #4 / Jun 19, 2011 10:02am

    Greg Salt

    3988 posts

    Hi James,

    Is this from an external site or from another page on your own site? If it’s from your own site you could just structure the link to contain the pid as another segment and then you can access that with the segment_3 variable. If it’s from an external site, you may have to adjust your system/expressionengine/config/config.php uri_protocol setting. Also, are you using mod_rewrite in an .htaccess file for this site?

    Cheers

    Greg

  • #5 / Jun 19, 2011 10:34pm

    james Brown

    492 posts

    i figured out another way around it. so for the time being i am ok. not sure why i couldn’t access the GET variables though.

  • #6 / Jun 20, 2011 3:49pm

    Brandon Jones

    5500 posts

    Hi James,

    There could be a few factors as Greg suggested. Sounds like you have a solution but let us know if you want to continue troubleshooting. Thanks!

  • #7 / Jun 20, 2011 3:50pm

    james Brown

    492 posts

    i’m ok for now. thanks.

  • #8 / Jun 20, 2011 3:53pm

    Brandon Jones

    5500 posts

    Okay, thanks James.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases