We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7575
    • 85 Posts
    hi

    I have a snippet that is more like a complete php page.
    right now it does the following

    gets the $_POST.
    shows a form (that shows the $_POST options)
    shows a list depending on the contents of the $_POST

    that works perfectly.

    what I want now is:
    In the list there are different items, each with it's own link
    example
    <a href=".../sport?y=2014&c=1&i=1">a title</a>


    on the top of my snippet I have following code:
    $y= mysql_real_escape_string($_GET['y']);
    $i= mysql_real_escape_string($_GET['i']);
    $c= mysql_real_escape_string($_GET['c']);
    
    if ($y==''or$i==''or$c==''){
    //show the list page as is
    ...
    }
    else{
    echo "show 1 item";
    }


    but I never get to "show 1 item"

    the link of the current page is
    ...modx/sport/

    and when I click on an item link
    .../sport?y=2014&c=1&i=1

    it still shwos the list page as is, I don't see the ?y=... bit in my url
    I also tried following as links:
    sport/?y=2014&c=1&i=1
    sport.html?y=2014&c=1&i=1
    sport.php?y=2014&c=1&i=1

    I could replace the ?y=2014&c=... with a hidden form,
    but that would mean ppl can't surf immediatly to the "show 1 item" page.

    any thoughts?

    greetings

    djemmers [ed. note: djemmers last edited this post 13 years, 9 months ago.]
      www.tornooi.net online database for (sport) events in dutch.
      To be redesigned, rewritten to modx with multiple languages...
      ANY help appreciated, I cannot offer money but I can offer free advertising on the site. just message me.
      • 11055 ☆ A M B ☆
      • 3,112 Posts

      Try this.
      if ($y == '' || $i == '' || $c == ''){
      //show the list page as is
      } else {
          echo "show 1 item";
      }
        Rico
        Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
        MODx is great, but knowing how to use it well makes it perfect!

        www.virtudraft.com

        Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets

        Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

        Maintainter/contributor of Babel

        Because it's hard to follow all topics on the forum, PING ME ON TWITTER @_goldsky if you need my help.
        • 7575
        • 85 Posts
        tnx for the suggestion goldsky,
        but I know it is not the "or", because I use it on other places in that snippet.
          www.tornooi.net online database for (sport) events in dutch.
          To be redesigned, rewritten to modx with multiple languages...
          ANY help appreciated, I cannot offer money but I can offer free advertising on the site. just message me.
          • 18373 ☆ A M B ☆
          • 3,141 Posts
          Have you tried echoing/var_dump-ing the values it gets from the $_GET values? I have a feeling it might be 'NULL' cause of the mysql_real_escape_string() function.
            Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

            Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
            • 7575
            • 85 Posts
            Indeed Mark,
            you hit the mark there
            the $_get values don't come through, that is actually my problem,
            maybe I wasn't clrear enough on that.

            the problem is,
            I can't seem to use $_get values...
              www.tornooi.net online database for (sport) events in dutch.
              To be redesigned, rewritten to modx with multiple languages...
              ANY help appreciated, I cannot offer money but I can offer free advertising on the site. just message me.
              • 18373 ☆ A M B ☆
              • 3,141 Posts
              You should be able to just use $_GET and $_POST etc in snippets like usual. Maybe something in your .htaccess (custom redirects) are causing it to get lost?
                Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
                • 7575
                • 85 Posts
                Quote from: markh at Dec 06, 2012, 04:15 PM
                You should be able to just use $_GET and $_POST etc in snippets like usual. Maybe something in your .htaccess (custom redirects) are causing it to get lost?
                that might be it. sadly I know nothing of .htacces
                here are the lines that are not commented out:
                RewriteEngine On
                RewriteBase /modx
                
                # The Friendly URLs part
                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteCond %{REQUEST_FILENAME} !-d
                RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
                
                
                  www.tornooi.net online database for (sport) events in dutch.
                  To be redesigned, rewritten to modx with multiple languages...
                  ANY help appreciated, I cannot offer money but I can offer free advertising on the site. just message me.
                  • 18373 ☆ A M B ☆
                  • 3,141 Posts
                  Try setting the RewriteBase to /modx/
                    Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                    Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
                    • 7575
                    • 85 Posts
                    that did it!
                    tnx Mark,
                    Don't know why or how, but adding the / did it!
                      www.tornooi.net online database for (sport) events in dutch.
                      To be redesigned, rewritten to modx with multiple languages...
                      ANY help appreciated, I cannot offer money but I can offer free advertising on the site. just message me.