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

    I have been trying to get a ContactForm, based on the snippet of the same
    name, working.

    This is pretty much the code as it stands but

    $SendMail = ''; 
    
    if (isset($_POST['testtext'])) { 
    
    $SendMail .= <<<MAILRESPONSE 
    
    <h3>Mail Response Here</h3> 
    
    MAILRESPONSE; 
    } 
    
    $SendMail .= <<<MAILFORM 
    
    <form method="POST" name="ecpemailform" id="ecpform" action="[~[*id*]~]"> 
        <input type="text" name="testtext" /> 
        <input type="submit" value="Send this Message" /> 
    </form> 
    
    MAILFORM; 
    return $SendMail; 


    If I put in

    var_dump($_POST);


    Then I get an empty array.

    Anyone know why this might be happening?

    cheers, Joc
      • 15987
      • 786 Posts
      Joc,
      Try using the snippet eForm. It is much better for creating contact forms, etc...
        • 14375
        • 3 Posts
        Hi,

        I’m more concerned that the form isn’t passing any variables.

        Joc
          • 22303 MODX Staff
          • 10,725 Posts
          Sounds like you have the page cached and your not calling the snippet with non-cacheable tags --> [! ... !]
            • 14375
            • 3 Posts
            Thank you embarrassed I should have asked 3 days ago.

            Joc