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

    I use &gotoid parameter to display a document after sending the form. On this doc, I would like to display the [+email+] value.

    I tried to add [+email+] in the content, but it’s not displayed.

    Thus, I try to set a cookie with &eFormOnBeforeMailSent in order to display it.. but the cookie is not set.

    Please, don’t laugh ( grin ), totally noob in PHP, here is my &eFormOnBeforeMailSent snippet
    <?php
    function passeEmailAuGotoid(  &$fields){
        global $modx;
            setcookie(decoinMailNewsletter,$fields['email']);
        return true;
    }
    ?>


    Am I on the right way... or totally lost ? tongue

    Any chance to do that easily ? Thank you smiley
      • 4310
      • 2,310 Posts
      <?php
      $val = $_POST['email];
      echo "$val";
      return;
      ?>

      As a snippet on the landing page should work, if I understand correctly!
        • 23050
        • 1,842 Posts
        Hi bunk, and thanks !

        $_POST is not usable in &gotoid page.

        Instead, I did this :

        In eForm call : &eFormOnBeforeMailSent=`passeEmailAuGotoid`

        passeEmailAuGotoid snippet :

        <?php
        function passeEmailAuGotoid(&$fields){
            $_SESSION['mailNewsletter'] = "";
            if(isset($fields['email'])){
               $_SESSION['mailNewsletter'] = $fields['email'];
           }
        
        return true;
        }
        ?>


        Then in &gotoid page :

        [!printPost!]

        where printPost snippet is

        <?php
        if(isset($_SESSION['mailNewsletter'])){
           $mail = $_SESSION['mailNewsletter'];
        }
        unset ($_SESSION['mailNewsletter']);
        return $mail;
        ?>


        Works fine !