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.

Retrieving get php string variables

August 27, 2010 11:48am

Subscribe [3]
  • #1 / Aug 27, 2010 11:48am

    Est. Studio

    6 posts

    I am trying to retrieve a get variable passed in a form to another page, but it inserts a second ? after the template, which throws it out. If i manually edit the ? for an & it works fine.

    This test is using the LG.htaccess, but tested with and out has the same results.

    http://mysite.com/results/&amount=67

    <?php echo $_GET['amount']; ?>

    This works fine

    http://mysite.com/results/?amount=67

    <?php echo $_GET['amount']; ?>

    This creates an error

    otice: Undefined index: amount in /var/www/web55/web/system/core/core.functions.php(634) : eval()'d code on line 1

    How can I post the form data without the adding a ‘?’ ?

    Thanks in advance i am sure this is stupidly easy 😊

  • #2 / Aug 27, 2010 3:31pm

    Sue Crocker

    26054 posts

    Using one of the available Find and Replace plugins, perhaps? You can find them on Devot-ee.com

  • #3 / Aug 27, 2010 6:31pm

    Est. Studio

    6 posts

    Thanks sue, although i think a find and replace might only be useful it the link were already constructed, however in this case the string is being generated through a get method from a form.

  • #4 / Aug 29, 2010 4:49pm

    Greg Salt

    3988 posts

    Hi Est. Studio,

    Please temporarily disable your .htaccess file rules to remove index.php from the URL. What is your URI Type set to in your index.php file? Have you changed it or is it still set to ‘0’:

    // URI Type
    // This variable allows you to hard-code the URI type.
    // For most servers, 0 works fine.
    // 0 = auto  
    // 1 = path_info  
    // 2 = query_string
    
    $qtype = 0;

    Does it work properly if you construct your form so that the form action includes the template file. For example:

    <form action="http://mysite.com/results/index.php" method="get">

    Cheers

    Greg

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

ExpressionEngine News!

#eecms, #events, #releases