Send e-mail without finalizing the form

Asked

Viewed 64 times

0

I have an html form in step by step, that when I click on the "next" button I need to send the completed data by email but without finalizing the form, how can I do this, is in php?

  • Put what you’ve tried in your peegunta.

2 answers

1


Can use AJAX, which is a mixture of PHP and JQUERY.

Here’s an example

$(".enviar_email").click(function(){ //botão para enviar
    var nome = $(this).attr("data-nome "); //variaveis
    var id = $(this).attr("data-id"); //variaveis
    $.ajax({
        type: "POST", //Pode usar, POST ou GET. Prefiro por POST
        url: "ajax/enviar_email.php", //ficheiro de envio de email com o código php nele
        data: "nome ="+nome +"&id="+id, //envio de variaveis pelo que você definiu no TYPE
        success: function(e){ //e equivale ao que retorna dele.
            console.log(e);
        }
    })
})
  • i by doing this, I can get the email sent without resetting the form right?

  • Yeah, try it on

  • Could you make me an example working? I couldn’t apply

  • How can I do it? I don’t know your code, post any HTML

0

To send an email you will need to use php as already answered in this other question here: How to send emails only with HTML5 basics

What do you mean, "Without completing the form"? If you want the person to come back later to fill out the rest of the form without having to re-enter the other information you can use Html5 and localstorage for this, storing the information within the user’s browser. Following link with explanations: https://www.devmedia.com.br/trabalhando-com-html5-local-storage-e-json/29045

If you want this information to be accessed from another browser or other computer, you will need to store it in a database.

  • I need that when clicking the "next" button what was filled be sent but without finalizing the form

  • Then you will only have to use php and ajax to send an email when you click next. So he will perform the function of sending the email without finalizing the form. Link that can be useful: https://www.w3schools.com/php/php_ajax_intro.asp

  • In fact what it is an ajax to do forumlar partial post without doing main form Submit.

  • That’s exactly what I’m gonna need you to do

Browser other questions tagged

You are not signed in. Login or sign up in order to post.