We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 43592
    • 97 Posts
    Dear forum members,

    please excuse, I'm new to snippets.

    I trying to retreive an email-adress via get for Formit.

    Snippet is called getmaildata:

    $_SESSION['emailadresse'] = $_GET['emailadresse'];
    return $_SESSION['emailadresse'];
    


    The sent e-mailadress shows up in a hidden field <input type="hidden" but cant be used in the Formit

    &emailTo=`[[!getmaildata]]`

    What is missing?

    This question has been answered by Bruno17. See the first response.

      • 4172
      • 5,888 Posts
      This should work, if you actually have the email in the GET, while the form was submitted.
      What is you whole formIt - call and your form?

      Be aware, with this method any user can send the contact-mail to any email-address.
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 43592
        • 97 Posts
        Thank you Bruno,

        I had the e-Mail in the GET and it also shows up in a hidden field by doing this:

        <input type="hidden" name="praxis" id="praxis" value="[[!getmaildata]]"/>


        this is the formit call:

        [[!FormIt?
        &hooks=`spam,email,redirect`
        &emailTpl=`tpl_kontakt`
        &emailTo=`[[!getmaildata]]`
        &emailBCC=`[[+fi.email]]`
        &emailSubject=`Nachricht an Sie über Domain`
        &redirectTo=`41`
        &validate=`nachname:required,
        email:email:required,
        nachricht:required:stripTags`
        ]]

        I tried it with a the hidden field above, too

        and then

        &emailBCC=`[[+praxis]]`

        Both didn't work.

        Thank you for your statement about GET, I'll try to put the email (it's a TV) in a session on the page before.
        • discuss.answer
          • 4172
          • 5,888 Posts
          You haven't it in the GET, when you send your form with the post-method
          then you would need to read the $_POST or $_REQUEST, but you could also store it to a Session-var, like it seems, you are trying
          But it has to be this way, then:

          if (isset($_GET['emailadresse'])){
              $_SESSION['emailadresse'] = $_GET['emailadresse'];
          }
          
          return $_SESSION['emailadresse'];


            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!