We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 52626
    • 1 Posts
    Im trying to create a snippet that will read $_POST data but print_r($_POST) returns array() but if i do print_r(file_get_contents('php://input')) it returns the data that im posting any suggestions on this?
      • 4172
      • 5,888 Posts
      so, how looks your form, how your snippet-code and how do you call that snippet?
      Anything else on that resource, where you have that snippet?
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 28432
        • 372 Posts
        Have you try to do ?

        print_r($_POST['nameOfTheFiled']);

        OR
        echo $_POST['nameOfTheFiled'];
          • 52064
          • 120 Posts
          a snippet must never do echo or print, but must return

          if you want to debug

          return json_encode($_POST);
          
            FerX - Developer at Eracom s.r.l.
            • 28432
            • 372 Posts
            Quote from: ferx77 at Aug 12, 2016, 01:23 AM
            a snippet must never do echo or print, but must return
            Thanks ! But i know... This is for me sometime the best way to debug...
            Next i will give a try to your
            return json_encode($_POST);
              • 3749
              • 24,544 Posts
              I do this:

              return '<pre>' . print_r($_POST, true) . '</pre>';


              The true argument is necessary, because otherwise print_r()'s output will go to stdout rather than being returned.
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 26681 MODX Staff
                • 123 Posts
                Quote from: gaz492 at Aug 11, 2016, 09:56 AM
                Im trying to create a snippet that will read $_POST data but print_r($_POST) returns array() but if i do print_r(file_get_contents('php://input')) it returns the data that im posting any suggestions on this?

                May I ask which version of Revo you're using? There's a specific case I was looking at recently where $_POST data was missing and I'm wondering if it could be related and a core bug (I highly doubt it but it's worth checking...)

                Thanks,
                  [sepiariver.com] (https://sepiariver.com/)