We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 47057
    • 4 Posts
    I'm new to modx and need to put a news letter signup form on my webpage...

    I have a "footer" chunk with the form markup on it and under this the call to my custom form processing snippet:

    <form id="nl-form" action="[[~[[*id]]]]" method="post">
     <input class="field" type="text" name"nl-name" placeholder="Name" value="" />
     <input class="field" type="email" name"nl-email" placeholder="Email" value="" />
     <input class="button" type="submit" name="nl-submit" value="Sends" />
    </form>
    [[!form-newsletter]]
    


    Below I have the form-newsletter code. It was more than this but I stripped it back to its bare minimum to see if the code was even being hit and I get nothing. I might be being a bit stupid as it's been a while since I did PHP, but im pretty sure this should work? Any ideas as to what I've done wrong as I'm pulling at straws right now. I'm using Revo 2.2.13 Traditional.

    <?php
    $output = '';
    
    if(isset($_POST['nl-submit'])) {
    
      $output .= $_POST['nl-name'];
    
    }
    
    return $output;
    


    [ed. note: dorzal last edited this post 12 years, 6 months ago.]
      • 4172
      • 5,888 Posts
      you should call your snippet uncached.
      Otherwise you would allways get the output of the first page-visit.

      [[!form-newsletter]]
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 47057
        • 4 Posts
        Sorry, I forgot to add the exclamation mark in my post, but I am using it, having alread found elsewhere that it should be used...original post updated [ed. note: dorzal last edited this post 12 years, 6 months ago.]
          • 4172
          • 5,888 Posts
          Can nothing see, why this shouldn't work, then.
          Doesn't it?
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!