We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32093
    • 21 Posts
    webcomsystems Reply #1, 17 years ago
    Guys,

    I’m sure this has been asked before but I cant figure it out.

    I have a page with a simple form and input text box .

    I want to pass the value of that input box into a snippet when the user hits the submit button. (snippet sits on the same page)

    How is this done?

    [[mysnippet &variable=`??input box value???`]]

    thanks
      • 4172
      • 5,888 Posts
      in your snippet use $_POST $_GET or $_REQUEST for example:

      <?php
      
      if (isset($_POST['myinputfield'])){
      
      $variable=$modx->db->escape($_POST['myinputfield']);
      
      }
      
      ?>
      

      and be sure your snippet is uncached, use [!mysnippet!] for uncached snippet-calls.
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 4172
        • 5,888 Posts
        []
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!