We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 39025
    • 21 Posts
    I have an old website that we converted to modX, on various pages throughout the website it had forms. The forms posted back to the pages they were on using:

    
    <?php echo $_SERVER['PHP_SELF']; ?>" method="post" id="formViews" name="formViews">
    
    


    Once the page reloaded some php code was ran that grabbed the form data, collected it, stored it in a database and redirected them to paypal to make a payment.

    Question.

    I set up a snippet that has -- return $url = $modx->makeUrl($modx->resource->get('id')); -- hoping that would post the form back to itself and run the code. It appears to posting back to the appropriate page now, but not executing the code. The php code is in another snippet included in a chunk.

    What is the proper way to do this and get it to work?
      • 3749
      • 24,544 Posts
      I think this is what you want:

      <form action="[[~[[*id]]]]" method="post" id="formViews" name="formViews">




      ------------------------------------------------------------------------------------------
      PLEASE, PLEASE specify the version of MODX you are using.
      MODX info for everyone: http://bobsguides.com/modx.html
        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