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

    I have installed Modx Revolution. No extras, MySQL database working fine.
    I have created a snippet with :
    <?php
    echo '<pre>'; print_r($_POST); echo '</pre>';
    return '<form action="[[~[[*id]]]]" method="post"><input type="text" name="some_input" /><input type="submit" value="Submit" /></form>';


    Put it in the ’Home’ document, went to index.php and I got this all the time :
    Array
    (
    )
    /* ... the form ... */


    Except when I do in the ModxManager /Site/Clear cache and just after I submit:

    Array
    (
        [some_input] => pouet
    )
    /* ... the form ... */


    But then whatever I do I have :

    Array
    (
        [some_input] => pouet
    )
    /* ... the form ... */


    Could someone help me?
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Any dynamic snippet (i.e. its return values are changeable depending on outside influence, such as a user submitting a form) must be called uncached. Otherwise, the page loads with the form, and has been cached. You submit the form which requests the same page again, and MODx simply takes it from the cache. The snippet tags aren’t even in the cached page any more, so all you’ll ever see is what was generated the first time the page was requested and the snippet was run.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 23763
        • 2 Posts
        Thank you!

        Just read the modx revolution documentation and replaced in the ’Home’ document :
        [[Login]]

        By :
        [[!Login]]

        And it works fine!