We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22654
    • 3 Posts
    Hi all,

    I am really new to Mod X but been coding PHP for years. I have a script that has my portfolio in it from my old non-CMS based site and as part of the site I send the value of the "chosen" variable over in a URL by clicking one of many links (dragged out of a DB table) on my portfolio.php page like so:

    <a href="http://mysite.com/image.php?chosen=4">open chosen image</a>


    Then I get the data for manipulation in my image.php page like so:

    <?php $myimage = $_GET[chosen]; ?>


    All super simple stuff except for when you try and do this in MODx.

    Please can someone tell me the process for passing variable values from one page to another in MODx with a GET?

    For the record. My data for these variable values is in an independent DB not the specific MODx DB as I need to use this table to populate other web applications as well with the same data.

    Cheers in advance

    Paul
      • 7231
      • 4,205 Posts
      That is the correct way to bring in a $_GET var. What happens if you do:
      <?php 
      $myimage = $_GET['chosen']; 
      return $myimage;
      ?>


      The var value should show on the page.
        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don&#39;t know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 22654
        • 3 Posts
        Quote from: dev_cw at Jan 15, 2009, 06:03 PM

        return $myimage;
        


        You so totally rock.

        That did it. the ’return’ was missing. I don’t normally need one in my usual style of coding as I use sessions a lot but this worked a treat.

        Thanks massively

        Paul grin